diff options
Diffstat (limited to 'test/Misc/ast-dump-stmt.cpp')
-rw-r--r-- | test/Misc/ast-dump-stmt.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Misc/ast-dump-stmt.cpp b/test/Misc/ast-dump-stmt.cpp index 72205c1..96921ff 100644 --- a/test/Misc/ast-dump-stmt.cpp +++ b/test/Misc/ast-dump-stmt.cpp @@ -38,3 +38,30 @@ void TestCatch2() { catch (...) { } } + +void TestAllocationExprs() { + int *p; + p = new int; + delete p; + p = new int[2]; + delete[] p; + p = ::new int; + ::delete p; +} +// CHECK: FunctionDecl {{.*}} TestAllocationExprs +// CHECK: CXXNewExpr {{.*}} 'int *' Function {{.*}} 'operator new' +// CHECK: CXXDeleteExpr {{.*}} 'void' Function {{.*}} 'operator delete' +// CHECK: CXXNewExpr {{.*}} 'int *' array Function {{.*}} 'operator new[]' +// CHECK: CXXDeleteExpr {{.*}} 'void' array Function {{.*}} 'operator delete[]' +// CHECK: CXXNewExpr {{.*}} 'int *' global Function {{.*}} 'operator new' +// CHECK: CXXDeleteExpr {{.*}} 'void' global Function {{.*}} 'operator delete' + +// Don't crash on dependent exprs that haven't been resolved yet. +template <typename T> +void TestDependentAllocationExpr() { + T *p = new T; + delete p; +} +// CHECK: FunctionTemplateDecl {{.*}} TestDependentAllocationExpr +// CHECK: CXXNewExpr {{.*'T \*'$}} +// CHECK: CXXDeleteExpr {{.*'void'$}} |