2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.oliva / thunk1.C
blob640023ff7888415256fd5998a4c6521cadc32c7e
1 // { dg-do run  }
2 // Copyright (C) 1999 Free Software Foundation
4 // by Alexandre Oliva <oliva@dcc.unicamp.br>
5 // based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se>
7 #include <cstdlib>
9 using namespace std;
11 struct vbase {
12   virtual int get_a() const = 0;
15 struct base: virtual vbase {
16   int a;
17   base(int aa) : a(aa) {}
18   int get_a() const { return a; }
21 struct mid: base {
22   mid(int bb) : base(bb) {
23     // when mid is not in charge of vbase initialization,
24     // a derived-aware vtable is needed for vbase
25     if (((vbase*)this)->get_a() != bb)
26       abort();
27   }
30 struct derived: virtual mid {
31   derived(int cc) : mid(cc) {}
34 int main () {
35   derived(1);