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()
2249
2249
tok2 = tok3->tokAt (3 );
2250
2250
else if (Token::Match (tok2->tokAt (3 ), " [(),;]" ))
2251
2251
tok2 = tok2->tokAt (2 );
2252
+ else if (Token::simpleMatch (tok2->tokAt (3 ), " >" ))
2253
+ tok2 = tok2->tokAt (2 );
2252
2254
else
2253
2255
tok2 = tok2->tokAt (3 );
2254
2256
if (!tok2)
Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ class TestSimplifyTypedef : public TestFixture {
214
214
TEST_CASE (simplifyTypedef148);
215
215
TEST_CASE (simplifyTypedef149);
216
216
TEST_CASE (simplifyTypedef150);
217
+ TEST_CASE (simplifyTypedef151);
217
218
218
219
TEST_CASE (simplifyTypedefFunction1);
219
220
TEST_CASE (simplifyTypedefFunction2); // ticket #1685
@@ -3530,6 +3531,18 @@ class TestSimplifyTypedef : public TestFixture {
3530
3531
ASSERT_EQUALS (exp, tok (code));
3531
3532
}
3532
3533
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
+
3533
3546
void simplifyTypedefFunction1 () {
3534
3547
{
3535
3548
const char code[] = " typedef void (*my_func)();\n "
You can’t perform that action at this time.
0 commit comments