diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index a70460f5a..d0f9c6f16 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -448,9 +448,10 @@ static bool iscast(const Token *tok) tok2 = tok2->link()->next(); if (tok2->str() == ")") - return type || tok2->strAt(-1) == "*" || + return type || tok2->strAt(-1) == "*" || Token::Match(tok2, ") &|~") || (Token::Match(tok2, ") %any%") && - (tok2->strAt(1) == "&" || (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[]);,?:.]")))); + !tok2->next()->isOp() && + !Token::Match(tok2->next(), "[[]);,?:.]")); if (!Token::Match(tok2, "%name%|*|&|::")) return false; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index b3d4d184c..dfe4e22cb 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8235,11 +8235,15 @@ private: ASSERT_EQUALS("ac&(=", testAst("a = (long)&c;")); ASSERT_EQUALS("ac*(=", testAst("a = (Foo*)*c;")); ASSERT_EQUALS("ac-(=", testAst("a = (long)-c;")); + ASSERT_EQUALS("ac~(=", testAst("a = (b)~c;")); ASSERT_EQUALS("ac(=", testAst("a = (some)c;")); ASSERT_EQUALS("afoveon_avgimage((foveon_avgimage((+=", testAst("a = foveon_avg(((short(*)[4]) image)) + foveon_avg(((short(*)[4]) image));")); ASSERT_EQUALS("c(40<