Reputation: 21
C++, VS 2012 (but the same thing happened in previous versions of VS).
Sometimes, the Intellisense finds "problems" that aren't really problems and puts its red squigglies under perfectly valid code.
Example:
class A {
A(const A&);
A& operator=(const A&);
public:
A(const wchar_t*, const wchar_t*, int);
#define AMsg(x) A(x, __FILEW__, __LINE__)
};
...
throw AMsg(L"abc");
The AMsg macro converts into a ctor call, saving one typing the obvious last two parameter values, the code works as expected, yet the Intellisense puts a red squiggly under AMsg saying that A::A(const A&) is inaccessible. A::A(const A&) is inaccessible, yes, but AMsg calls a different ctor, and the Intellisense fails to see that.
Is there a way to somehow make the Intellisense just ignore AMsg? I remember we could, for example, edit the keyword list for the editor which was stored in a file, maybe there is some file or macros (e.g., a "do not parse the contents of this particular file" one?) that helps control the Intellisense?
Upvotes: 2
Views: 886
Reputation: 179981
The "problem" is that the Intellisense compiler is built on top of EDG's compiler, not MSVC itself. EDG's compiler is far closer to the standard, which means that it catches problems today which MSVC might catch next year.
Intellisense can't be turned on or off on parts of your code base. That just doesn't make sense. Assume it would ignore int foo(int)
and then the compiler would include int foo(int)
in overload resolution. Your whole program could change.
Upvotes: 1