gcc/testsuite/g++.dg/cpp0x/pr82560.C
raw| 1 | // { dg-do run { target c++11 } } |
| 2 | // PR82560, failed to destruct default arg inside new |
| 3 | |
| 4 | static int liveness = 0; |
| 5 | |
| 6 | struct Foo { |
| 7 | |
| 8 | Foo (int) { |
| 9 | liveness++; |
| 10 | } |
| 11 | |
| 12 | ~Foo() { |
| 13 | liveness--; |
| 14 | } |
| 15 | |
| 16 | }; |
| 17 | |
| 18 | struct Bar { |
| 19 | Bar (Foo = 0) { } |
| 20 | ~Bar() { } |
| 21 | }; |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | delete new Bar(); |
| 26 | |
| 27 | return liveness != 0;; |
| 28 | } |