Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.dg / inherit / thunk1.C
blob3bbd05069df37261fad512b074cf463b90029b1a
1 // { dg-do run { target i?86-*-* x86_64-*-* s390*-*-* alpha*-*-* ia64-*-* sparc*-*-* } }
3 #include <stdarg.h>
5 extern "C" void abort ();
7 struct A {
8   virtual void f (int, ...) {}
9   int i;
12 struct B : virtual public A {
15 struct C : public B {
16   C ();
17   virtual void f (int, ...);
20 extern C* cp;
22 C::C () { cp = this; }
24 void C::f (int i, ...) {
25   if (this != cp)
26     abort ();
27   va_list ap;
28   if (i != 3)
29     abort ();
30   va_start (ap, i);
31   if (va_arg (ap, int) != 7)
32     abort ();
33   va_end (ap);
36 C* cp = new C;
38 int main () 
40   cp->f (3, 7);