From: Jakub Jelinek Date: Wed, 25 Sep 2024 14:07:11 +0000 (+0200) Subject: c++: Add testcase for DR 2728 X-Git-Tag: basepoints/gcc-16~5686 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=340ef96560da93891418c39d38b5d90f6bd47053;p=thirdparty%2Fgcc.git 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 * g++.dg/DRs/dr2728.C: New test. --- diff --git a/gcc/testsuite/g++.dg/DRs/dr2728.C b/gcc/testsuite/g++.dg/DRs/dr2728.C new file mode 100644 index 00000000000..3061b8445fc --- /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 (); +}