Fixed #5891 (AST: wrong ast generated for 'x = (int)(double(123)*i);')

This commit is contained in:
Daniel Marjamäki 2014-10-16 15:57:05 +02:00
parent eefaddf980
commit 7107286be6
2 changed files with 2 additions and 1 deletions

View File

@ -453,7 +453,7 @@ static bool iscast(const Token *tok)
if (!Token::Match(tok2, "%var%|*|&|::"))
return false;
if (tok2->isStandardType())
if (tok2->isStandardType() && tok2->next()->str() != "(")
type = true;
}

View File

@ -8547,6 +8547,7 @@ private:
ASSERT_EQUALS("afoveon_avgimage((foveon_avgimage((+=", testAst("a = foveon_avg(((short(*)[4]) image)) + foveon_avg(((short(*)[4]) image));"));
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);"));
}
void astlambda() const {