On 9/25/24 9:57 AM, Jakub Jelinek wrote:
Hi!
Seems we already handle delete expressions the way the DR clarifies,
so this patch just adds a testcase which verifies that.
Tested on x86_64-linux, ok for trunk?
OK.
2024-09-25 Jakub Jelinek <ja...@redhat.com>
* g++.dg/DRs/dr2728.C: New test.
--- gcc/testsuite/g++.dg/DRs/dr2728.C.jj 2024-09-25 13:44:15.102534622
+0200
+++ gcc/testsuite/g++.dg/DRs/dr2728.C 2024-09-25 13:44:09.876605940 +0200
@@ -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 ();
+}
Jakub