Skip to content

Commit d88e67c

Browse files
Update testsimplifytypedef.cpp
1 parent 47aaa76 commit d88e67c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/testsimplifytypedef.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class TestSimplifyTypedef : public TestFixture {
231231
TEST_CASE(simplifyTypedef158);
232232
TEST_CASE(simplifyTypedef159);
233233
TEST_CASE(simplifyTypedef160);
234+
TEST_CASE(simplifyTypedef161);
234235

235236
TEST_CASE(simplifyTypedefFunction1);
236237
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
@@ -3842,6 +3843,22 @@ class TestSimplifyTypedef : public TestFixture {
38423843
ASSERT_EQUALS(exp2, simplifyTypedefC(code2));
38433844
}
38443845

3846+
void simplifyTypedef161() {
3847+
const char code[] = "namespace N {\n" // #11775
3848+
" typedef int A[3];\n"
3849+
" p = new A*[n];\n"
3850+
"}\n";
3851+
const char cur[] = "namespace N { p = new int ( * [ n ] ) [ 3 ] ; }";
3852+
const char exp[] = "namespace N { p = new ( int ( * [ n ] ) [ 3 ] ) ; }";
3853+
TODO_ASSERT_EQUALS(exp, cur, tok(code));
3854+
3855+
const char code2[] = "typedef int A[3];\n"
3856+
"p = new A*[n];\n";
3857+
const char cur2[] = "p = new int ( * ) [ n ] [ 3 ] ;";
3858+
const char exp2[] = "p = new ( int ( * [ n ] ) [ 3 ] ) ;";
3859+
TODO_ASSERT_EQUALS(exp2, cur2, tok(code2));
3860+
}
3861+
38453862
void simplifyTypedefFunction1() {
38463863
{
38473864
const char code[] = "typedef void (*my_func)();\n"

0 commit comments

Comments
 (0)