c++inheritanceintellisense

Is Visual C++ intellisense "smarter" than the compiler


I have the following scenario.

I have a base class from which a class derives. Everything appears good however, every time I hover my mouse cursor over an inherited member of the base class, the intellisense shows it fine, EG BaseClass::SomeMember. However, when I try to compile, the compiler shows various errors(they are about the variables and member functions that the intellisense was reporting well). The compiler says 'they're not valid identifiers', that they don't 'belong to a global namespace'. Does anyone know why this is occurring?


Solution

  • If this is VC2010, then yes, in a sense Intellisense is smarter. They switched to using EDG's compiler frontend for IntelliSense, and that is a stricter, more standards-compliant compiler than Microsoft's own one. So there are cases where IntelliSense and the "real" compiler disagrees.

    Sometimes IntelliSense is wrong because it doesn't have the complete picture (it runs in a different context, and processes only small snippets of the code at a time), and sometimes Intellisense is right and the compiler is wrong (in terms of C++ standard compliance), because EDG's frontend is just better in that respect.