Fix Ticket #32 False positive with --style: Uninitialized member variable (when stream is used)

This commit is contained in:
Reijo Tomperi 2009-01-17 20:17:57 +00:00
parent bfc82f29eb
commit 58b398a4a8
2 changed files with 7 additions and 3 deletions

View File

@ -249,6 +249,12 @@ void CheckClass::ClassChecking_VarList_Initialize(const Token *tok1, const Token
if (indentlevel < 1)
continue;
// Variable getting value from stream?
if (Token::Match(ftok, ">> %var%"))
{
InitVar(varlist, ftok->next()->aaaa());
}
// Before a new statement there is "[{};)=]" or "else"
if (! Token::Match(ftok, "[{};)=]") && ftok->str() != "else")
continue;

View File

@ -43,9 +43,7 @@ private:
TEST_CASE(virtualDestructor5); // Derived class has empty destructor => no error
TEST_CASE(uninitVar1);
// TODO, cppcheck currently produces false positive, this should be fixed
// TEST_CASE(uninitVarStream);
TEST_CASE(uninitVarStream);
}
// Check that base classes have virtual destructors