diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 6c4cd7eb981..1ab00ee3574 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -547,7 +547,7 @@ static bool iscast(const Token *tok, bool cpp) if (!Token::Match(tok2, "%name%|*|::")) return false; - if (tok2->isStandardType() && (tok2->strAt(1) != "(" || Token::Match(tok2->next(), "( * *| )"))) + if (tok2->isStandardType() && (tok2->strAt(1) != "(" || Token::simpleMatch(tok2->linkAt(1)->tokAt(-1), "* )"))) type = true; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index a81130c3114..a7e8c40cd37 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8421,7 +8421,8 @@ class TestTokenizer : public TestFixture { void ccast() { const char code[] = "a = (int)x;\n" // #13579 - "int (*p)[10];\n"; + "int (*p)[10];\n" + "b = (void (S::*)(int) const)&y;"; SimpleTokenizer tokenizer(settingsDefault, *this); ASSERT(tokenizer.tokenize(code)); @@ -8430,6 +8431,8 @@ class TestTokenizer : public TestFixture { ASSERT(par->isCast()); par = Token::findsimplematch(par->next(), "("); ASSERT(!par->isCast()); + par = Token::findsimplematch(par->next(), "("); + ASSERT(par->isCast()); } #define checkHdrs(...) checkHdrs_(__FILE__, __LINE__, __VA_ARGS__)