diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 51ada82a3..0436d8517 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2754,7 +2754,7 @@ void Tokenizer::setVarId() continue; const Token *tok3 = tok2->next(); - if (!tok3->isStandardType() && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) { + if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) { variableId[tok2->previous()->str()] = ++_varId; tok = tok2->previous(); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 691af6f75..e2eec9b3c 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3749,6 +3749,12 @@ private: ASSERT_EQUALS(expected, actual); } + { + const std::string actual = tokenizeDebugListing("void f(struct foobar);", false, "test.c"); + const std::string expected("\n\n##file 0\n" + "1: void f ( struct foobar ) ;\n"); + ASSERT_EQUALS(expected, actual); + } } void varid_sizeof() {