Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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__)
Expand Down
Loading