Skip to content

Commit

Permalink
Fix #13281 internalAstError with delete and increment/decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Oct 28, 2024
1 parent 17a10d0 commit 7d69964
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ static Token * createAstAtToken(Token *tok)
}
}

if (Token::Match(tok, "%type% %name%|*|&|::") && !Token::Match(tok, "return|new")) {
if (Token::Match(tok, "%type% %name%|*|&|::") && !Token::Match(tok, "return|new|delete")) {
int typecount = 0;
Token *typetok = tok;
while (Token::Match(typetok, "%type%|::|*|&")) {
Expand Down
1 change: 1 addition & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6345,6 +6345,7 @@ class TestTokenizer : public TestFixture {
ASSERT_EQUALS("sSint(new::(new=", testAst("s = new S(::new int());")); // #12502
ASSERT_EQUALS("sS(new::=", testAst("s = ::new (ptr) S();")); // #12552
ASSERT_EQUALS("pdelete::return", testAst("return ::delete p;"));
ASSERT_EQUALS("gn--(delete", testAst("delete g(--n);"));

// placement new
ASSERT_EQUALS("X12,3,(new ab,c,", testAst("new (a,b,c) X(1,2,3);"));
Expand Down

0 comments on commit 7d69964

Please sign in to comment.