https://gcc.gnu.org/g:340ef96560da93891418c39d38b5d90f6bd47053
commit r15-3867-g340ef96560da93891418c39d38b5d90f6bd47053 Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Sep 25 16:07:11 2024 +0200 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 <ja...@redhat.com> * g++.dg/DRs/dr2728.C: New test. Diff: --- gcc/testsuite/g++.dg/DRs/dr2728.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gcc/testsuite/g++.dg/DRs/dr2728.C b/gcc/testsuite/g++.dg/DRs/dr2728.C new file mode 100644 index 000000000000..3061b8445fc1 --- /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 (); +}