gcc/testsuite/g++.old-deja/g++.other/dtor8.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-O1" } |
| 3 | // Origin: Mark Mitchell <[email protected]> |
| 4 | |
| 5 | int result; |
| 6 | |
| 7 | struct S |
| 8 | { |
| 9 | S (); |
| 10 | S (const S&); |
| 11 | ~S (); |
| 12 | |
| 13 | int i; |
| 14 | double d[18]; |
| 15 | }; |
| 16 | |
| 17 | S* s; |
| 18 | |
| 19 | S::S () |
| 20 | { |
| 21 | s = this; |
| 22 | } |
| 23 | |
| 24 | S::~S () |
| 25 | { |
| 26 | if (s != this) |
| 27 | result = 1; |
| 28 | } |
| 29 | |
| 30 | inline S f () |
| 31 | { |
| 32 | return S (); |
| 33 | } |
| 34 | |
| 35 | int main () |
| 36 | { |
| 37 | f (); |
| 38 | return result; |
| 39 | } |