diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 63f002645..30dbfc824 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -991,7 +991,7 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti while (tok && !Token::simpleMatch(tok, ";") && !isScopeBracket(tok)) { if (tok->str() == ",") ++argnr; - else if (tok->str() == ")") + else if (Token::Match(tok, ")|}")) tok = tok->link(); else if (Token::Match(tok->previous(), "%name% (|{")) break; diff --git a/test/testcondition.cpp b/test/testcondition.cpp index aeec2040a..dd55d2d75 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -3216,6 +3216,19 @@ private: " return 1;\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + // #9319 + check("struct S {\n" + " int a;\n" + " int b;\n" + "};\n" + "void g(S s, bool& x);\n" + "void f() {\n" + " bool x = false;\n" + " g({0, 1}, x);\n" + " if (x) {}\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void alwaysTrueContainer() {