diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 07bc29f4580..42d50f63571 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -102,7 +102,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end tok = tok->link(); if (tok->str() != ")") return nullptr; - if (!tok->isCpp() && !Token::Match(tok->link()->previous(), "%name%|)")) + if (!tok->isCpp() && !Token::Match(tok->link()->previous(), "%name%|(|)")) return nullptr; if (Token::Match(tok, ") ;|{|[")) { tok = tok->next(); diff --git a/test/testvarid.cpp b/test/testvarid.cpp index ea8934b2403..02ea62f6f3d 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -1294,6 +1294,10 @@ class TestVarID : public TestFixture { 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"; ASSERT_EQUALS(expected3, tokenize(code3, true)); + + const char code4[] = "_Static_assert(sizeof((struct S){0}.i) == 4);\n"; // #12729 + const char expected4[] = "1: _Static_assert ( sizeof ( ( struct S ) { 0 } . i ) == 4 ) ;\n"; + ASSERT_EQUALS(expected4, tokenize(code4, false)); } void varid71() {