diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index de80b8e66..c51dcaffb 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -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; diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index da83ec69d..2373bc891 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -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"