Fixed crash on complex cast.

This commit is contained in:
PKEuS 2014-05-24 20:21:08 +02:00
parent d42275c5f1
commit 55c87248ba
2 changed files with 2 additions and 1 deletions

View File

@ -383,7 +383,7 @@ static bool iscast(const Token *tok)
bool type = false;
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
if (tok2->link() && tok2->str() == "<")
while (tok2->link() && Token::Match(tok2, "(|[|<"))
tok2 = tok2->link()->next();
if (tok2->str() == ")")

View File

@ -10600,6 +10600,7 @@ private:
ASSERT_EQUALS("ac*(=", testAst("a = (Foo*)*c;"));
ASSERT_EQUALS("ac-(=", testAst("a = (long)-c;"));
ASSERT_EQUALS("ac(=", testAst("a = (some<strange, type>)c;"));
ASSERT_EQUALS("afoveon_avgimage((foveon_avgimage((+=", testAst("a = foveon_avg(((short(*)[4]) image)) + foveon_avg(((short(*)[4]) image));"));
ASSERT_EQUALS("ab-(=", testAst("a = ((int)-b)")); // Multiple subsequent unary operators (cast and -)
}