summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/dtor5.C
blob: fc1ef385d9cd2bb4a9cf3ee9bf3b828b84549503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// { dg-do run  }
// Origin: Mark Mitchell <mark@codesourcery.com>

extern "C" void abort ();

struct B;

struct S 
{
  S (B*);
  ~S ();

  B* b_;
};

struct B 
{
  B () : s (this) { }
      
  virtual void f () { }
  
  S s;
};

S::S (B* b) : b_ (b) { }

S::~S () { b_->f (); }
  
struct D : public B
{
  virtual void f () { abort (); }
};

int main ()
{
  D d;
}