Fixed #2306 (False positive: array of std::string is reported as uninitialized)

This commit is contained in:
Daniel Marjamäki 2010-12-17 21:20:04 +01:00
parent 696550abd3
commit c2335f845e
2 changed files with 8 additions and 0 deletions

View File

@ -435,6 +435,7 @@ private:
// Variable declaration for array..
if (Token::Match(vartok, "%type% %var% [") &&
vartok->isStandardType() &&
Token::simpleMatch(vartok->tokAt(2)->link(), "] ;"))
{
vartok = vartok->next();

View File

@ -946,6 +946,13 @@ private:
" int b = a[0];\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo()\n"
"{\n"
" Fred a[2];\n"
" Fred b = a[0];\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
// alloc..