Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;')

This commit is contained in:
Daniel Marjamäki 2016-01-25 10:29:24 +01:00
parent edfdb5c15f
commit 7663b6ee75
2 changed files with 2 additions and 1 deletions

View File

@ -440,7 +440,7 @@ struct AST_state {
static bool iscast(const Token *tok)
{
if (!Token::Match(tok, "( %name%"))
if (!Token::Match(tok, "( ::| %name%"))
return false;
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")

View File

@ -8300,6 +8300,7 @@ private:
ASSERT_EQUALS("c(40<<return", testAst("return (long long)c << 40;"));
ASSERT_EQUALS("ab-(=", testAst("a = ((int)-b)")); // Multiple subsequent unary operators (cast and -)
ASSERT_EQUALS("xdouble123(i*(=", testAst("x = (int)(double(123)*i);"));
ASSERT_EQUALS("ac(=", testAst("a = (::b)c;"));
// not cast
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));