aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2728.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/DRs/dr2728.C b/gcc/testsuite/g++.dg/DRs/dr2728.C
new file mode 100644
index 0000000..3061b84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2728.C
@@ -0,0 +1,20 @@
+// DR 2728 - Evaluation of conversions in a delete-expression
+// { dg-do run }
+
+struct S {
+ S (int *x) : p (x) {}
+ operator int * () const { ++s; return p; }
+ int *p;
+ static int s;
+};
+int S::s;
+
+int
+main ()
+{
+ int *a = new int;
+ S s (a);
+ delete s;
+ if (S::s != 1)
+ __builtin_abort ();
+}