FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.oliva / thunk1.C
blob0aa2178da5d3110a1431bf9559f73854be7141d6
1 // Copyright (C) 1999 Free Software Foundation
3 // by Alexandre Oliva <oliva@dcc.unicamp.br>
4 // based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se>
6 #include <cstdlib>
8 using namespace std;
10 struct vbase {
11   virtual int get_a() const = 0;
14 struct base: virtual vbase {
15   int a;
16   base(int aa) : a(aa) {}
17   int get_a() const { return a; }
20 struct mid: base {
21   mid(int bb) : base(bb) {
22     // when mid is not in charge of vbase initialization,
23     // a derived-aware vtable is needed for vbase
24     if (((vbase*)this)->get_a() != bb)
25       abort();
26   }
29 struct derived: virtual mid {
30   derived(int cc) : mid(cc) {}
33 int main () {
34   derived(1);