AST: fixed ast for 'a = new (b) ::X;'
This commit is contained in:
parent
f96ea94048
commit
649e2dfa97
|
@ -662,7 +662,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
if (tok->str() == "(") {
|
||||
if (Token::Match(tok, "( &| %var%") && Token::Match(tok->link(), ") ( %type%") && Token::simpleMatch(tok->link()->linkAt(1), ") ("))
|
||||
tok = tok->link()->next();
|
||||
if (Token::Match(tok->link(), ") %type%"))
|
||||
if (Token::Match(tok->link(), ") ::| %type%"))
|
||||
tok = tok->link()->next();
|
||||
else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [();,]"))
|
||||
tok = tok->next();
|
||||
|
@ -670,7 +670,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
|
|||
tok = tok->next();
|
||||
}
|
||||
state.op.push(tok);
|
||||
while (Token::Match(tok, "%var%|*|&|<")) {
|
||||
while (Token::Match(tok, "%var%|*|&|<|::")) {
|
||||
if (tok->link())
|
||||
tok = tok->link();
|
||||
tok = tok->next();
|
||||
|
|
|
@ -8393,11 +8393,12 @@ private:
|
|||
ASSERT_EQUALS("adelete", testAst("delete (a);"));
|
||||
ASSERT_EQUALS("adelete", testAst("delete[] a;"));
|
||||
ASSERT_EQUALS("ab.3c-(delete", testAst("delete[] a.b(3 - c);"));
|
||||
ASSERT_EQUALS("a::new=", testAst("a = new (b) ::X;"));
|
||||
|
||||
// clang testsuite..
|
||||
ASSERT_EQUALS("const0(new", testAst("new const auto (0);"));
|
||||
ASSERT_EQUALS("autonew", testAst("new (auto) (0.0);"));
|
||||
ASSERT_EQUALS("intnew", testAst("new (int S::*[3][4][5]) ();"));
|
||||
ASSERT_EQUALS("int3[4[5[new", testAst("new (int S::*[3][4][5]) ();"));
|
||||
ASSERT_EQUALS("pSnew=", testAst("p=new (x)(S)(1,2);"));
|
||||
ASSERT_EQUALS("inti[new(", testAst("(void)new (int[i]);"));
|
||||
ASSERT_EQUALS("intp* pnew malloc4(", testAst("int*p; new (p) (malloc(4));"));
|
||||
|
|
Loading…
Reference in New Issue