Fixed #3906 (false positive uninitvar for vector pointer)
This commit is contained in:
parent
951da02f89
commit
354406441a
|
@ -1058,7 +1058,8 @@ void CheckUninitVar::checkScope(const Scope* scope)
|
||||||
if (tok->isStandardType())
|
if (tok->isStandardType())
|
||||||
stdtype = true;
|
stdtype = true;
|
||||||
}
|
}
|
||||||
|
while (tok && tok->str() != ";")
|
||||||
|
tok = tok->next();
|
||||||
if (stdtype || i->isPointer())
|
if (stdtype || i->isPointer())
|
||||||
checkScopeForVariable(tok, *i, NULL);
|
checkScopeForVariable(tok, *i, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2158,6 +2158,12 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// Ticket #3906 - False positive for std::vector pointer
|
||||||
|
checkUninitVar2("void f() {\n"
|
||||||
|
" std::vector<int> *x = NULL;\n"
|
||||||
|
" return x;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// #3869 - reference variable
|
// #3869 - reference variable
|
||||||
|
|
Loading…
Reference in New Issue