Uninitialized variables: fix fp when 'a=((b)=c)' is used

This commit is contained in:
Daniel Marjamäki 2015-01-06 18:03:40 +01:00
parent 3404bc9ab0
commit a87fb96eaf
2 changed files with 7 additions and 1 deletions

View File

@ -376,7 +376,7 @@ private:
if (tok2->varId() &&
!Token::Match(tok2->previous(), "&|::") &&
!Token::simpleMatch(tok2->tokAt(-2), "& (") &&
tok2->strAt(1) != "=") {
!Token::Match(tok2->tokAt(1), ")| =")) {
// Multiple assignments..
if (Token::Match(tok2->next(), ".|[")) {
const Token * tok3 = tok2;

View File

@ -303,6 +303,12 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("static void foo() {\n"
" int x, y;\n"
" x = ((y) = 10);\n"
"}");
ASSERT_EQUALS("", errout.str());
// Ticket #3597
checkUninitVar("int f() {\n"
" int a;\n"