gcc/testsuite/g++.old-deja/g++.other/dtor11.C
raw| 1 | // { dg-do run } |
| 2 | // Origin: Mark Mitchell <[email protected]> |
| 3 | |
| 4 | extern "C" void abort (); |
| 5 | |
| 6 | int j; |
| 7 | |
| 8 | struct S { |
| 9 | S () { ++j; } |
| 10 | S (const S&) { ++j; } |
| 11 | ~S () { |
| 12 | if (--j < 0) |
| 13 | abort (); |
| 14 | } |
| 15 | }; |
| 16 | |
| 17 | struct T { |
| 18 | void g (S) { |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | struct U { |
| 23 | int i; |
| 24 | S s; |
| 25 | }; |
| 26 | |
| 27 | U u; |
| 28 | |
| 29 | U f () { return u; } |
| 30 | |
| 31 | int main () |
| 32 | { |
| 33 | T t; |
| 34 | t.g (f ().s); |
| 35 | } |