Fixed #1209 (False positive: uninitialized variable c when it is initialized with 'ab(sizeof(xyz), &c)')

This commit is contained in:
Daniel Marjamäki 2010-01-02 18:16:44 +01:00
parent bcafb30d0d
commit d82079e86f
2 changed files with 9 additions and 1 deletions

View File

@ -1660,7 +1660,7 @@ private:
else if (Token::simpleMatch(tok2, "sizeof (")) else if (Token::simpleMatch(tok2, "sizeof ("))
{ {
tok2 = tok2->link(); tok2 = tok2->next()->link();
if (!tok2) if (!tok2)
break; break;
} }

View File

@ -1148,6 +1148,14 @@ private:
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkUninitVar("void f()\n"
"{\n"
" int c;\n"
" ab(sizeof(xyz), &c);\n"
" if (c);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// goto.. // goto..
checkUninitVar("void foo(int x)\n" checkUninitVar("void foo(int x)\n"
"{\n" "{\n"