Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;')
This commit is contained in:
parent
edfdb5c15f
commit
7663b6ee75
|
@ -440,7 +440,7 @@ struct AST_state {
|
||||||
|
|
||||||
static bool iscast(const Token *tok)
|
static bool iscast(const Token *tok)
|
||||||
{
|
{
|
||||||
if (!Token::Match(tok, "( %name%"))
|
if (!Token::Match(tok, "( ::| %name%"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")
|
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")
|
||||||
|
|
|
@ -8300,6 +8300,7 @@ private:
|
||||||
ASSERT_EQUALS("c(40<<return", testAst("return (long long)c << 40;"));
|
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("ab-(=", testAst("a = ((int)-b)")); // Multiple subsequent unary operators (cast and -)
|
||||||
ASSERT_EQUALS("xdouble123(i*(=", testAst("x = (int)(double(123)*i);"));
|
ASSERT_EQUALS("xdouble123(i*(=", testAst("x = (int)(double(123)*i);"));
|
||||||
|
ASSERT_EQUALS("ac(=", testAst("a = (::b)c;"));
|
||||||
|
|
||||||
// not cast
|
// not cast
|
||||||
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
||||||
|
|
Loading…
Reference in New Issue