summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/delete-mismatch.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/delete-mismatch.h')
-rw-r--r--test/SemaCXX/delete-mismatch.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/delete-mismatch.h b/test/SemaCXX/delete-mismatch.h
new file mode 100644
index 0000000..84fcd61
--- /dev/null
+++ b/test/SemaCXX/delete-mismatch.h
@@ -0,0 +1,15 @@
+// Header for PCH test delete.cpp
+namespace pch_test {
+struct X {
+ int *a;
+ X();
+ X(int);
+ X(bool)
+ : a(new int[1]) { } // expected-note{{allocated with 'new[]' here}}
+ ~X()
+ {
+ delete a; // expected-warning{{'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?}}
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:9}:"[]"
+ }
+};
+}
OpenPOWER on IntegriCloud