Skip to content

Commit 635bc69

Browse files
committed
Fix #15079 Regression: FP syntaxError for C-style cast before ::
1 parent 2c6098d commit 635bc69

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎lib/tokenize.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9179,8 +9179,8 @@ void Tokenizer::findGarbageCode() const
91799179
syntaxError(tok);
91809180
if (Token::simpleMatch(tok->tokAt(-1), ")")) {
91819181
const Token* const prev = tok->linkAt(-1)->tokAt(-1);
9182-
if (!Token::Match(prev, "%name% (") || (!prev->isControlFlowKeyword() && prev->str() != "decltype")) {
9183-
if (prev && prev->isUpperCaseName())
9182+
if (prev && prev->isNameOnly()) {
9183+
if (prev->isUpperCaseName())
91849184
unknownMacroError(prev);
91859185
else
91869186
syntaxError(tok);

‎test/testtokenize.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7929,6 +7929,14 @@ class TestTokenizer : public TestFixture {
79297929
" }\n"
79307930
"}\n"), UNKNOWN_MACRO);
79317931

7932+
ASSERT_NO_THROW(tokenizeAndStringify("void f(void* h) {\n" // #15079
7933+
" (void)::CloseHandle(h);\n"
7934+
" int i = (int)::GetTickCount();\n"
7935+
"}\n"
7936+
"std::size_t* g(void* p) {\n"
7937+
" return new (p) ::std::size_t;\n"
7938+
"}\n"));
7939+
79327940
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("static void handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, int var) {}\n"), // #13198
79337941
UNKNOWN_MACRO,
79347942
"There is an unknown macro here somewhere. Configuration is required. If PROTO_XT_CALLBACK_ARGS is a macro then please configure it.");

0 commit comments

Comments
 (0)