AST: don't hang when using auto in new statement
This commit is contained in:
parent
b5faf3a0cc
commit
66d4614a87
|
@ -667,7 +667,11 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
tok = tok->link();
|
||||
tok = tok->next();
|
||||
}
|
||||
if (tok->str() == "[" || tok->str() == "(")
|
||||
if (Token::Match(tok, "( %type% ) (")) {
|
||||
state.op.push(tok->next());
|
||||
tok = tok->tokAt(3);
|
||||
compileBinOp(tok, state, compilePrecedence2);
|
||||
} else if (tok->str() == "[" || tok->str() == "(")
|
||||
compilePrecedence2(tok, state);
|
||||
compileUnaryOp(tok2, state, nullptr);
|
||||
} else if (state.cpp && Token::Match(tok, "delete %var%|*|&|::|(|[")) {
|
||||
|
|
|
@ -8378,6 +8378,10 @@ private:
|
|||
ASSERT_EQUALS("adelete", testAst("delete (a);"));
|
||||
ASSERT_EQUALS("adelete", testAst("delete[] a;"));
|
||||
ASSERT_EQUALS("ab.3c-(delete", testAst("delete[] a.b(3 - c);"));
|
||||
|
||||
// clang testsuite..
|
||||
ASSERT_EQUALS("const0(new", testAst("new const auto (0);"));
|
||||
ASSERT_EQUALS("auto0.0(new", testAst("new (auto) (0.0);"));
|
||||
}
|
||||
|
||||
void astpar() const { // parentheses
|
||||
|
|
Loading…
Reference in New Issue