Fix 10739: internalAstError with decltype (#3723)
This commit is contained in:
parent
ebd1fbbfd8
commit
57b50e4b00
|
@ -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%|(")) {
|
||||
|
|
|
@ -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.(<i++;;( asize.(", testAst("for (decltype(a.size()) i = 0; i < a.size(); ++i);"));
|
||||
ASSERT_EQUALS("foria:( asize.(", testAst("for(decltype(a.size()) i:a);"));
|
||||
|
||||
// for with initializer (c++20)
|
||||
ASSERT_EQUALS("forab=ca:;(", testAst("for(a=b;int c:a)"));
|
||||
|
|
Loading…
Reference in New Issue