gcc/testsuite/g++.old-deja/g++.other/dtor5.C
raw| 1 | // { dg-do run } |
| 2 | // Origin: Mark Mitchell <[email protected]> |
| 3 | |
| 4 | extern "C" void abort (); |
| 5 | |
| 6 | struct B; |
| 7 | |
| 8 | struct S |
| 9 | { |
| 10 | S (B*); |
| 11 | ~S (); |
| 12 | |
| 13 | B* b_; |
| 14 | }; |
| 15 | |
| 16 | struct B |
| 17 | { |
| 18 | B () : s (this) { } |
| 19 | |
| 20 | virtual void f () { } |
| 21 | |
| 22 | S s; |
| 23 | }; |
| 24 | |
| 25 | S::S (B* b) : b_ (b) { } |
| 26 | |
| 27 | S::~S () { b_->f (); } |
| 28 | |
| 29 | struct D : public B |
| 30 | { |
| 31 | virtual void f () { abort (); } |
| 32 | }; |
| 33 | |
| 34 | int main () |
| 35 | { |
| 36 | D d; |
| 37 | } |