Type: LanguageService
Describe the bug
To Reproduce
struct Value {
struct Array;
struct Dict;
struct Primitive;
Value() {}
virtual ~Value() {}
virtual Array * asArray() { assert(false); }
virtual Dict * asDict() { assert(false); }
virtual Primitive * asPrimitive() { assert(false); }
int asInt();
double asDouble();
std::string asDate();
std::string asString();
};
struct Value::Array : public Value {
Array() {}
~Array() {}
Value::Array * asArray() {
Value::Array * result = this;
return result;
}
};
Expected behavior
This is a legitimate assignment and there should not be an error.
Screenshots

other info:
Might related to this on StackOverflow, though it's not clear whether the problem described in that post occurred in VSCode or other IDE/editor.
However, this is in a .h file. Moving the definition of asArray() to another .cpp file solves the issue.

I'm able to repro the bug. It's a bug inherited from VS. I normally would create a bug on VS myself, but they've asked us to have users to report it themselves at https://developercommunity.visualstudio.com/content/problem/post.html?space=62 -- simply pasting a link to this bug report would be good enough. If that is too much of a burden for you, let me know, and I'll open the bug myself.
@sean-mcmanus hi thanks for your feedback! However it requires an MS account but I don't have one and don't intend to create one at the moment...
If you click the "Sign-in options" you should be able to login using your GitHub account.

I filed a VS bug https://developercommunity.visualstudio.com/content/problem/471939/c-intellisense-incorrectly-show-a-value-of-type-x.html . But it sounds like they want more upvotes before they'll fix it.
Looks like this was already reported in July (from the Stack Overflow): https://developercommunity.visualstudio.com/content/problem/293884/e0144-being-reported-for-valid-code-intellisense-e.html . It needs more upvotes.
encountered the same issue
@stcheng Are you able to upvote the VS issue at https://developercommunity.visualstudio.com/content/problem/293884/e0144-being-reported-for-valid-code-intellisense-e.html ? Or if enough people can upvote this GitHub issue we may be able to get them to re-open it.
Just hit this myself.
Annoying problem - please fix.
To suppress this error, you can add
#if __INTELLISENSE__
#pragma diag_suppress 144
#endif
to some code in the TU, such as in a forcedInclude:
"forcedInclude": [
"${workspaceFolder}/ingoreIntelliSenseErrors.h"
]
Starting with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4, the error codes are added to the IntelliSense errors, so other invalid errors can be suppressed as well.
Most helpful comment
To suppress this error, you can add
to some code in the TU, such as in a forcedInclude:
Starting with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4, the error codes are added to the IntelliSense errors, so other invalid errors can be suppressed as well.