diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d5f1ad837..44c3cf9d9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1147,7 +1147,7 @@ void Tokenizer::simplifyTypedef() typeStart = tok->next(); offset = 1; - while (Token::Match(tok->tokAt(offset), "const|signed|unsigned|struct|enum") || + while (Token::Match(tok->tokAt(offset), "const|signed|unsigned|struct|enum %type%") || (tok->tokAt(offset + 1) && tok->tokAt(offset + 1)->isStandardType())) offset++; diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index d4e8b42d6..c5da21f0f 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -269,6 +269,7 @@ private: TEST_CASE(simplifyTypedef101); // ticket #3003 (segmentation fault) TEST_CASE(simplifyTypedef102); // ticket #3004 TEST_CASE(simplifyTypedef103); // ticket #3007 + TEST_CASE(simplifyTypedef104); // ticket #3070 TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -5418,6 +5419,13 @@ private: ASSERT_EQUALS("", errout.str()); } + void simplifyTypedef104() // ticket #3070 + { + const char code[] = "typedef int (*in_func) (void FAR *, unsigned char FAR * FAR *);\n"; + ASSERT_EQUALS(";", sizeof_(code)); + ASSERT_EQUALS("", errout.str()); + } + void simplifyTypedefFunction1() { {