Fixed #3890 (False positive Uninitialized variable on returning default value on a class member)
This commit is contained in:
parent
14591b3211
commit
ce5c38f52c
|
@ -1054,9 +1054,10 @@ void CheckUninitVar::checkScope(const Scope* scope)
|
|||
|
||||
bool stdtype = false;
|
||||
const Token* tok = i->typeStartToken();
|
||||
for (; tok->str() != ";"; tok = tok->next())
|
||||
for (; tok->str() != ";" && tok->str() != "<"; tok = tok->next()) {
|
||||
if (tok->isStandardType())
|
||||
stdtype = true;
|
||||
}
|
||||
|
||||
if (stdtype || i->isPointer())
|
||||
checkScopeForVariable(tok, *i, NULL);
|
||||
|
|
|
@ -2150,6 +2150,14 @@ private:
|
|||
" int a, a2, a2*x; if () ;\n"
|
||||
" )\n"
|
||||
"}\n");
|
||||
|
||||
// Ticket #3890 - False positive for std::map
|
||||
checkUninitVar2("void f() {\n"
|
||||
" std::map<int,bool> x;\n"
|
||||
" return x;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
}
|
||||
|
||||
// #3869 - reference variable
|
||||
|
|
Loading…
Reference in New Issue