Fixed #10271 (AST; Token::astOperand2() cyclic dependency in static_assert)
This commit is contained in:
parent
c9a9b56e0e
commit
be95e2bf21
|
@ -477,7 +477,6 @@ static Token * skipDecl(Token *tok)
|
||||||
{
|
{
|
||||||
if (!Token::Match(tok->previous(), "( %name%"))
|
if (!Token::Match(tok->previous(), "( %name%"))
|
||||||
return tok;
|
return tok;
|
||||||
|
|
||||||
Token *vartok = tok;
|
Token *vartok = tok;
|
||||||
while (Token::Match(vartok, "%name%|*|&|::|<")) {
|
while (Token::Match(vartok, "%name%|*|&|::|<")) {
|
||||||
if (vartok->str() == "<") {
|
if (vartok->str() == "<") {
|
||||||
|
@ -487,7 +486,7 @@ static Token * skipDecl(Token *tok)
|
||||||
return tok;
|
return tok;
|
||||||
} else if (Token::Match(vartok, "%var% [:=(]")) {
|
} else if (Token::Match(vartok, "%var% [:=(]")) {
|
||||||
return vartok;
|
return vartok;
|
||||||
} else if (Token::simpleMatch(vartok, "decltype (")) {
|
} else if (Token::simpleMatch(vartok, "decltype (") && !Token::Match(tok->linkAt(1), ") [,)]")) {
|
||||||
return vartok->linkAt(1)->next();
|
return vartok->linkAt(1)->next();
|
||||||
}
|
}
|
||||||
vartok = vartok->next();
|
vartok = vartok->next();
|
||||||
|
|
|
@ -5822,9 +5822,6 @@ private:
|
||||||
ASSERT_EQUALS("decltypex({", testAst("decltype(x){};"));
|
ASSERT_EQUALS("decltypex({", testAst("decltype(x){};"));
|
||||||
ASSERT_EQUALS("decltypexy+(yx+(", testAst("decltype(x+y)(y+x);"));
|
ASSERT_EQUALS("decltypexy+(yx+(", testAst("decltype(x+y)(y+x);"));
|
||||||
ASSERT_EQUALS("decltypexy+(yx+{", testAst("decltype(x+y){y+x};"));
|
ASSERT_EQUALS("decltypexy+(yx+{", testAst("decltype(x+y){y+x};"));
|
||||||
|
|
||||||
// Check that decltype(x){} doesn't break AST creation for subsequent tokens.
|
|
||||||
ASSERT_EQUALS("decltypex({01:?", testAst("decltype(x){} ? 0 : 1;"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void astbrackets() { // []
|
void astbrackets() { // []
|
||||||
|
@ -5851,6 +5848,8 @@ private:
|
||||||
|
|
||||||
// create ast for decltype
|
// create ast for decltype
|
||||||
ASSERT_EQUALS("decltypex( var1=", testAst("decltype(x) var = 1;"));
|
ASSERT_EQUALS("decltypex( var1=", testAst("decltype(x) var = 1;"));
|
||||||
|
ASSERT_EQUALS("a1bdecltypet((>2,(", testAst("a(1 > b(decltype(t)), 2);")); // #10271
|
||||||
|
ASSERT_EQUALS("decltypex({01:?", testAst("decltype(x){} ? 0 : 1;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void astunaryop() { // unary operators
|
void astunaryop() { // unary operators
|
||||||
|
|
Loading…
Reference in New Issue