@@ -55,7 +55,8 @@ class TestClangImport: public TestFixture {
5555 TEST_CASE (cxxMethodDecl1);
5656 TEST_CASE (cxxMethodDecl2);
5757 TEST_CASE (cxxMethodDecl3);
58- TEST_CASE (cxxNewExpr);
58+ TEST_CASE (cxxNewExpr1);
59+ TEST_CASE (cxxNewExpr2);
5960 TEST_CASE (cxxNullPtrLiteralExpr);
6061 TEST_CASE (cxxOperatorCallExpr);
6162 TEST_CASE (cxxRecordDecl1);
@@ -504,7 +505,7 @@ class TestClangImport: public TestFixture {
504505 " void foo ( ) { }" , parse (clang));
505506 }
506507
507- void cxxNewExpr () {
508+ void cxxNewExpr1 () {
508509 const char clang[] = " |-VarDecl 0x3a97680 <1.cpp:2:1, col:14> col:6 i 'int *' cinit\n "
509510 " | `-CXXNewExpr 0x3a97d18 <col:10, col:14> 'int *' Function 0x3a97778 'operator new' 'void *(unsigned long)'\n "
510511 " `-VarDecl 0x3a97d80 <line:3:1, col:21> col:6 j 'int *' cinit\n "
@@ -516,6 +517,17 @@ class TestClangImport: public TestFixture {
516517 parse (clang));
517518 }
518519
520+ void cxxNewExpr2 () {
521+ const char clang[] = " |-FunctionDecl 0x59a188 <line:7:1, line:9:1> line:7:11 f 'struct S *()'\n "
522+ " | `-CompoundStmt 0x5c4318 <col:15, line:9:1>\n "
523+ " | `-ReturnStmt 0x5c4308 <line:8:3, col:14>\n "
524+ " | `-CXXNewExpr 0x5c42c8 <col:10, col:14> 'S *' Function 0x59a378 'operator new' 'void *(unsigned long)'\n "
525+ " | `-CXXConstructExpr 0x5c42a0 <col:14> 'S' 'void () noexcept'" ;
526+ ASSERT_EQUALS (" struct S * f ( ) {\n "
527+ " return new S ( ) ; }" ,
528+ parse (clang));
529+ }
530+
519531 void cxxNullPtrLiteralExpr () {
520532 const char clang[] = " `-VarDecl 0x2a7d650 <1.cpp:1:1, col:17> col:13 p 'const char *' cinit\n "
521533 " `-ImplicitCastExpr 0x2a7d708 <col:17> 'const char *' <NullToPointer>\n "
0 commit comments