File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1523,8 +1523,8 @@ void Tokenizer::simplifyTypedef()
1523
1523
if (tok2->str () == " const" )
1524
1524
tok2 = tok2->next ();
1525
1525
1526
- // reference to array?
1527
- if (tok2->str () == " &" ) {
1526
+ // reference or pointer to array?
1527
+ if (tok2->str () == " &" || tok2-> str () == " * " ) {
1528
1528
tok2 = tok2->previous ();
1529
1529
tok2->insertToken (" (" );
1530
1530
Token *tok3 = tok2->next ();
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ class TestSimplifyTypedef : public TestFixture {
163
163
TEST_CASE (simplifyTypedef123); // ticket #7406
164
164
TEST_CASE (simplifyTypedef124); // ticket #7792
165
165
TEST_CASE (simplifyTypedef125); // #8749 - typedef char A[10]; p = new A[1];
166
+ TEST_CASE (simplifyTypedef126); // ticket #5953
166
167
167
168
TEST_CASE (simplifyTypedefFunction1);
168
169
TEST_CASE (simplifyTypedefFunction2); // ticket #1685
@@ -2532,6 +2533,13 @@ class TestSimplifyTypedef : public TestFixture {
2532
2533
ASSERT_EQUALS (exp, tok (code, false ));
2533
2534
}
2534
2535
2536
+ void simplifyTypedef126 () { // #5953
2537
+ const char code[] = " typedef char automap_data_t[100];\n "
2538
+ " void write_array(automap_data_t *data) {}" ;
2539
+ const char exp [] = " void write_array ( char ( * data ) [ 100 ] ) { }" ;
2540
+ ASSERT_EQUALS (exp, tok (code, false ));
2541
+ }
2542
+
2535
2543
void simplifyTypedefFunction1 () {
2536
2544
{
2537
2545
const char code[] = " typedef void (*my_func)();\n "
You can’t perform that action at this time.
0 commit comments