diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index f6430abdd..4cee3f838 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -1424,6 +1424,11 @@ static Token * createAstAtToken(Token *tok, bool cpp) } Token *tok2 = skipDecl(tok->tokAt(2)); + if (Token::simpleMatch(tok->tokAt(2), "decltype (")) { + Token* tok3 = tok->tokAt(4); + AST_state state1(cpp); + compileExpression(tok3, state1); + } Token *init1 = nullptr; Token * const endPar = tok->next()->link(); if (tok2 == tok->tokAt(2) && Token::Match(tok2, "%op%|(")) { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index bacc6e553..90638b15f 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -5906,6 +5906,8 @@ private: ASSERT_EQUALS("for(tmpNULL!=tmptmpnext.=;;( tmpa=", testAst("for ( ({ tmp = a; }) ; tmp != NULL; tmp = tmp->next ) {}")); ASSERT_EQUALS("forx0=x;;(", testAst("for (int x=0; x;);")); ASSERT_EQUALS("forae*bc.({:(", testAst("for (a *e : {b->c()});")); + ASSERT_EQUALS("fori0=iasize.(