diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c7711d34b..112a3f749 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -707,9 +707,10 @@ Token * Tokenizer::deleteInvalidTypedef(Token *typeDef) // remove typedef but leave ; while (typeDef->next()) { - if (level == 0 && typeDef->next()->str() == ";") + if (level == 0 && typeDef->next()->str() == ";") { + typeDef->deleteNext(); break; - else if (typeDef->next()->str() == "{") + } else if (typeDef->next()->str() == "{") ++level; else if (typeDef->next()->str() == "}") { if (!level) diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index a6463d359..1367e2be0 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -5010,7 +5010,7 @@ private: const char code[] = "typedef FMAC1 void (* a) ();\n" "void *(*b) ();\n"; const std::string actual(sizeof_(code)); - ASSERT_EQUALS("; void * * b ;", actual); + ASSERT_EQUALS("void * * b ;", actual); ASSERT_EQUALS("", errout.str()); }