From c537c98751c44737349cf393b3f1c08414f981a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 12 Oct 2014 09:24:43 +0200 Subject: [PATCH] AST: fixed ast for 'a(new (X));' --- lib/tokenlist.cpp | 2 +- test/testtokenize.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 49eb774db..eae11879e 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -664,7 +664,7 @@ static void compilePrecedence3(Token *&tok, AST_state& state) tok = tok->link()->next(); if (Token::Match(tok->link(), ") %type%")) tok = tok->link()->next(); - else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [(;]")) + else if (Token::Match(tok, "( %type%") && Token::Match(tok->link(), ") [();]")) tok = tok->next(); else if (Token::Match(tok, "( &| %var%") && Token::simpleMatch(tok->link(), ") (")) tok = tok->next(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 56ab03f50..64e700e95 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8387,6 +8387,7 @@ private: ASSERT_EQUALS("aFoobar(new=", testAst("a = new Foo(bar);")); ASSERT_EQUALS("aFoo(new=", testAst("a = new Foo();")); ASSERT_EQUALS("X12,3,(new", testAst("new (a,b,c) X(1,2,3);")); + ASSERT_EQUALS("aXnew(", testAst("a (new (X));")); ASSERT_EQUALS("adelete", testAst("delete a;")); ASSERT_EQUALS("adelete", testAst("delete (a);")); ASSERT_EQUALS("adelete", testAst("delete[] a;"));