gcc/testsuite/g++.dg/DRs/dr2728.C
raw| 1 | // DR 2728 - Evaluation of conversions in a delete-expression |
| 2 | // { dg-do run } |
| 3 | |
| 4 | struct S { |
| 5 | S (int *x) : p (x) {} |
| 6 | operator int * () const { ++s; return p; } |
| 7 | int *p; |
| 8 | static int s; |
| 9 | }; |
| 10 | int S::s; |
| 11 | |
| 12 | int |
| 13 | main () |
| 14 | { |
| 15 | int *a = new int; |
| 16 | S s (a); |
| 17 | delete s; |
| 18 | if (S::s != 1) |
| 19 | __builtin_abort (); |
| 20 | } |