diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-09-25 16:07:11 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-09-25 16:26:35 +0200 |
commit | 340ef96560da93891418c39d38b5d90f6bd47053 (patch) | |
tree | 557fc844531ec1b56c8e763d098bb6ee27d45f50 /gcc | |
parent | a88d6c6d777ad7c9235e2e620318f26e5347e50a (diff) | |
download | gcc-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.C | 20 |
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 (); +} |