summaryrefslogtreecommitdiff
path: root/test/SemaCXX/new-delete.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/new-delete.cpp')
-rw-r--r--test/SemaCXX/new-delete.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index efdfa0f066dbf..748ce77700976 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -397,3 +397,22 @@ namespace ArrayNewNeedsDtor {
return new B[5]; // expected-note {{implicit default destructor for 'ArrayNewNeedsDtor::B' first required here}}
}
}
+
+namespace DeleteIncompleteClass {
+ struct A; // expected-note {{forward declaration}}
+ extern A x;
+ void f() { delete x; } // expected-error {{deleting incomplete class type}}
+}
+
+namespace DeleteIncompleteClassPointerError {
+ struct A; // expected-note {{forward declaration}}
+ void f(A *x) { 1+delete x; } // expected-warning {{deleting pointer to incomplete type}} \
+ // expected-error {{invalid operands to binary expression}}
+}
+
+namespace PR10504 {
+ struct A {
+ virtual void foo() = 0;
+ };
+ void f(A *x) { delete x; } // expected-warning {{delete called on 'PR10504::A' that is abstract but has non-virtual destructor}}
+}