gcc/testsuite/g++.old-deja/g++.other/dtor7.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-O2" } |
| 3 | // Origin: Mark Mitchell <[email protected]> |
| 4 | |
| 5 | int i; |
| 6 | int j; |
| 7 | |
| 8 | struct A |
| 9 | { |
| 10 | A (); |
| 11 | A (const A&); |
| 12 | ~A (); |
| 13 | }; |
| 14 | |
| 15 | A::A () |
| 16 | { |
| 17 | ++i; |
| 18 | } |
| 19 | |
| 20 | A::A (const A&) |
| 21 | { |
| 22 | ++i; |
| 23 | } |
| 24 | |
| 25 | A::~A () |
| 26 | { |
| 27 | --i; |
| 28 | } |
| 29 | |
| 30 | A f () |
| 31 | { |
| 32 | return A (); |
| 33 | } |
| 34 | |
| 35 | void g (const A&) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | int main () |
| 40 | { |
| 41 | g (f ()); |
| 42 | return i; |
| 43 | } |