diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 6df2070d5..16f637dd2 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -667,7 +667,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state) tok = tok->link(); tok = tok->next(); } - if (tok->str() == "[") + if (tok->str() == "[" || tok->str() == "(") compilePrecedence2(tok, state); compileUnaryOp(tok2, state, nullptr); } else if (state.cpp && Token::Match(tok, "delete %var%|*|&|::|(|[")) { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index a7caa72a7..2e162ba4e 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8370,9 +8370,10 @@ private: void astnewdelete() const { ASSERT_EQUALS("aintnew=", testAst("a = new int;")); ASSERT_EQUALS("aint4[new=", testAst("a = new int[4];")); - ASSERT_EQUALS("aFoonew=", testAst("a = new Foo(bar);")); - ASSERT_EQUALS("aFoonew=", testAst("a = new Foo();")); - ASSERT_EQUALS("Xnew", testAst("new (a,b,c) X(1,2,3);")); + ASSERT_EQUALS("aFoobar(new=", testAst("a = new Foo(bar);")); + ASSERT_EQUALS("aFoobar(new=", testAst("a = new Foo(bar);")); + ASSERT_EQUALS("aFoo(new=", testAst("a = new Foo();")); + ASSERT_EQUALS("X12,3,(new", testAst("new (a,b,c) X(1,2,3);")); ASSERT_EQUALS("adelete", testAst("delete a;")); ASSERT_EQUALS("adelete", testAst("delete (a);")); ASSERT_EQUALS("adelete", testAst("delete[] a;"));