Fixed #1061 (false positve: uninitialized variable)
This commit is contained in:
parent
e2473314b5
commit
91114c50d2
|
@ -1576,7 +1576,7 @@ void CheckOther::executionPaths()
|
|||
for (; tok; tok = tok->next())
|
||||
{
|
||||
// skip structs
|
||||
if (Token::Match(tok->previous(), "[;{}] struct %var% {"))
|
||||
if (Token::Match(tok, "struct %var% {"))
|
||||
{
|
||||
tok = tok->tokAt(2)->link();
|
||||
continue;
|
||||
|
|
|
@ -1242,6 +1242,15 @@ private:
|
|||
" };\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
" static const struct ab {\n"
|
||||
" int a,b;\n"
|
||||
" int get_a() { return a; }"
|
||||
" } = { 0, 0 };\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue