diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index d55d75c55..b4849ee5a 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -971,6 +971,10 @@ static void compilePrecedence2(Token *&tok, AST_state& state) else compileUnaryOp(tok, state, compileExpression); tok = tok2->link()->next(); + } else if (Token::simpleMatch(tok, "( {") && Token::simpleMatch(tok->linkAt(1)->previous(), "; } )") && !Token::Match(tok->previous(), "%name% (")) { + state.op.push(tok->next()); + tok = tok->link()->next(); + continue; } else if (tok->str() == "(" && (!iscast(tok, state.cpp) || Token::Match(tok->previous(), "if|while|for|switch|catch"))) { Token* tok2 = tok; tok = tok->next(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 374a295ec..e93dd76a3 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6266,6 +6266,7 @@ private: ASSERT_EQUALS("fori10=i{;;( i--", testAst("for (i=10;i;({i--;}) ) {}")); ASSERT_EQUALS("c{1{,{2.3f{,(", testAst("c({{}, {1}}, {2.3f});")); + ASSERT_EQUALS("x{{= e0= assert0(", testAst("x = {({ int e = 0; assert(0); e; })};")); // function pointer TODO_ASSERT_EQUALS("todo", "va_argapvoid((,(*0=", testAst("*va_arg(ap, void(**) ()) = 0;"));