diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 7c73e6331..a5f38a45d 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1554,7 +1554,7 @@ void Tokenizer::simplifyTypedef() // handle missing variable name if (Token::Match(tok3, "( *|&|&& *|&|&& %name%")) tok2 = tok3->tokAt(3); - else if (Token::Match(tok2->tokAt(3), "[(),]")) + else if (Token::Match(tok2->tokAt(3), "[(),;]")) tok2 = tok2->tokAt(2); else tok2 = tok2->tokAt(3); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 1a177dc68..c7e3a192e 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -168,6 +168,7 @@ private: TEST_CASE(simplifyTypedef130); // ticket #9446 TEST_CASE(simplifyTypedef131); // ticket #9446 TEST_CASE(simplifyTypedef132); // ticket #9739 - using + TEST_CASE(simplifyTypedef133); // ticket #9812 - using TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -2653,6 +2654,13 @@ private: ASSERT_EQUALS(exp, tok(code, false)); } + void simplifyTypedef133() { // #9812 + const char code[] = "typedef unsigned char array_t[16];\n" + "using array_p = const array_t *;\n" + "array_p x;\n"; + ASSERT_EQUALS("using array_p = const unsigned char ( * ) [ 16 ] ; array_p x ;", tok(code, false)); + } + void simplifyTypedefFunction1() { { const char code[] = "typedef void (*my_func)();\n"