diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 3fba1f374..261f13fb1 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2845,6 +2845,17 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map= 2 && tok2 && tok2->str() == "[") { + const Token *tok3 = tok2; + while (tok3 && tok3->str() == "[") { + tok3 = tok3->link()->next(); + } + if (Token::Match(tok3, "= %num%")) + return false; + } + return bool(typeCount >= 2 && tok2 && Token::Match(tok2->tokAt(-2), "!!:: %type%")); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index a13000244..5970c54e3 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3607,7 +3607,7 @@ private: "3: AAA\n" "4: a@1 [ 0 ] = 0 ;\n" "5: }\n"; - ASSERT_EQUALS(expected, tokenizeDebugListing(code)); + ASSERT_EQUALS(expected, tokenizeDebugListing(code, false, "test.c")); } void varid_using() {