File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2249,6 +2249,8 @@ void Tokenizer::simplifyTypedefCpp()
22492249 tok2 = tok3->tokAt (3 );
22502250 else if (Token::Match (tok2->tokAt (3 ), " [(),;]" ))
22512251 tok2 = tok2->tokAt (2 );
2252+ else if (Token::simpleMatch (tok2->tokAt (3 ), " >" ))
2253+ tok2 = tok2->tokAt (2 );
22522254 else
22532255 tok2 = tok2->tokAt (3 );
22542256 if (!tok2)
Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ class TestSimplifyTypedef : public TestFixture {
214214 TEST_CASE (simplifyTypedef148);
215215 TEST_CASE (simplifyTypedef149);
216216 TEST_CASE (simplifyTypedef150);
217+ TEST_CASE (simplifyTypedef151);
217218
218219 TEST_CASE (simplifyTypedefFunction1);
219220 TEST_CASE (simplifyTypedefFunction2); // ticket #1685
@@ -3530,6 +3531,18 @@ class TestSimplifyTypedef : public TestFixture {
35303531 ASSERT_EQUALS (exp, tok (code));
35313532 }
35323533
3534+ void simplifyTypedef151 () {
3535+ const char * code{}, *exp{};
3536+ code = " namespace N {\n " // #12597
3537+ " typedef int T[10];\n "
3538+ " const T* f() { return static_cast<const T*>(nullptr); }\n "
3539+ " }\n " ;
3540+ exp = " namespace N { "
3541+ " const int ( * f ( ) ) [ 10 ] { return static_cast < const int ( * ) [ 10 ] > ( nullptr ) ; } "
3542+ " }" ;
3543+ ASSERT_EQUALS (exp, tok (code));
3544+ }
3545+
35333546 void simplifyTypedefFunction1 () {
35343547 {
35353548 const char code[] = " typedef void (*my_func)();\n "
You can’t perform that action at this time.
0 commit comments