diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index d08964fd4..667ae4c22 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -479,6 +479,14 @@ static void compileTerm(Token *& tok, std::stack &op) } else if (Token::Match(tok,"( {")) { op.push(tok->next()); tok = tok->link()->next(); + } else if (Token::simpleMatch(tok->link(),") (")) { + // Parenthesized sub-expression + Token *nextpar = tok->link()->next(); + tok = tok->next(); + compileExpression(tok,op); + tok = nextpar; + compileBinOp(tok, compileExpression, op); + tok = tok->next(); } else { // Parenthesized sub-expression tok = tok->next(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 2f6b1751d..e5b45ec0e 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10016,6 +10016,8 @@ private: ASSERT_EQUALS("123+*4*", testAst("1*(2+3)*4")); ASSERT_EQUALS("ifab.c&d==(", testAst("if((a.b&c)==d){}")); + ASSERT_EQUALS("pf.pf.12,(&&", testAst("((p.f) && (p.f)(1,2))")); + // casts ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;")); ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;"));