diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index f8ecd2e3a..789f37214 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -377,7 +377,7 @@ static bool iscast(const Token *tok) for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) { if (!Token::Match(tok2, "%var%|*|&|::")) - return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[]);,]")); + return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && !Token::Match(tok2->next(), "[[]);,?:]")); } return false; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 9a112e2bb..eaed38ccf 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10152,6 +10152,7 @@ private: 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("ab1?0:=", testAst("a=(b)?1:0;")); // ({..}) ASSERT_EQUALS("a{+d+ bc+", testAst("a+({b+c;})+d"));