diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 40dbdf88f9d..ba533098b5d 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -4704,6 +4704,16 @@ void Tokenizer::setVarIdPass1() bool initlist = false; bool inlineFunction = false; for (Token *tok = list.front(); tok; tok = tok->next()) { + if (Token::simpleMatch(tok, ") (") && Token::simpleMatch(tok->link(), "( *")) { + const Token *typeTok = tok->link()->previous(); + while (Token::Match(typeTok, "*|&")) { + typeTok = tok->previous(); + } + if (Token::Match(typeTok, "%type%")) { + tok = tok->linkAt(1); + continue; + } + } if (tok->isOp()) continue; if (cpp && Token::simpleMatch(tok, "template <")) { diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 007e16ffb29..71916eb0276 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -1328,7 +1328,7 @@ class TestVarID : public TestFixture { ASSERT_EQUALS(expected2, tokenize(code2)); const char code3[] = "extern void (*arr[10])(uint32_t some);\n"; - const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some@2 ) ;\n"; + const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some ) ;\n"; ASSERT_EQUALS(expected3, tokenize(code3)); const char code4[] = "_Static_assert(sizeof((struct S){0}.i) == 4);\n"; // #12729