diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 3d80ebf9c..d07430400 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -363,7 +363,7 @@ static bool iscast(const Token *tok) return false; for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) { - if (!Token::Match(tok2, "%var%|*")) + if (!Token::Match(tok2, "%var%|*|&|::")) return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && tok2->next()->str() != "["); } @@ -531,8 +531,6 @@ static void compileMulDiv(Token *&tok, std::stack &op) compileDot(tok,op); while (tok) { if (Token::Match(tok, "[*/%]")) { - if (Token::Match(tok, "* [,)]")) - break; compileBinOp(tok, compileDot, op); } else break; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 18dab17e5..7ccde8236 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10033,6 +10033,9 @@ private: // casts ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;")); ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;")); + ASSERT_EQUALS("a1(2+=",testAst("a=(t*)1+2;")); + ASSERT_EQUALS("a1(2+=",testAst("a=(t&)1+2;")); + ASSERT_EQUALS("ab::r&c(=", testAst("a::b& r = (a::b&)c;")); // #5261 // ({..}) ASSERT_EQUALS("a{+d+", testAst("a+({b+c;})+d"));