Fixed #4717 (False positive: Uninitialized variable inside ({..}))
This commit is contained in:
parent
1935c544e0
commit
4c8b17c040
|
@ -1084,6 +1084,8 @@ void CheckUninitVar::checkScope(const Scope* scope)
|
|||
}
|
||||
while (tok && tok->str() != ";")
|
||||
tok = tok->next();
|
||||
if (Token::findsimplematch(i->typeStartToken(), "=", tok))
|
||||
continue;
|
||||
if (stdtype || i->isPointer())
|
||||
checkScopeForVariable(scope, tok, *i, NULL, NULL, "");
|
||||
if (Token::Match(i->typeStartToken(), "struct %type% %var% ;")) {
|
||||
|
|
|
@ -2350,6 +2350,11 @@ private:
|
|||
" x((A)(B)&a);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar2("void f() {\n" // #4717 - ({})
|
||||
" int a = ({ long b = (long)(123); 2 + b; });\n"
|
||||
"}", "test.c");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// #3869 - reference variable
|
||||
|
|
Loading…
Reference in New Issue