Fix Ticket #32 False positive with --style: Uninitialized member variable (when stream is used)
This commit is contained in:
parent
bfc82f29eb
commit
58b398a4a8
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue