aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-09-25 16:07:11 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-09-25 16:26:35 +0200
commit340ef96560da93891418c39d38b5d90f6bd47053 (patch)
tree557fc844531ec1b56c8e763d098bb6ee27d45f50 /gcc
parenta88d6c6d777ad7c9235e2e620318f26e5347e50a (diff)
downloadgcc-340ef96560da93891418c39d38b5d90f6bd47053.zip
gcc-340ef96560da93891418c39d38b5d90f6bd47053.tar.gz
gcc-340ef96560da93891418c39d38b5d90f6bd47053.tar.bz2
c++: Add testcase for DR 2728
Seems we already handle delete expressions the way the DR clarifies, so this patch just adds a testcase which verifies that. 2024-09-25 Jakub Jelinek <jakub@redhat.com> * g++.dg/DRs/dr2728.C: New test.
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 ();
+}