summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/inherit/thunk1.C
blob: 3bbd05069df37261fad512b074cf463b90029b1a (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
38
39
40
41
// { dg-do run { target i?86-*-* x86_64-*-* s390*-*-* alpha*-*-* ia64-*-* sparc*-*-* } }

#include <stdarg.h>

extern "C" void abort ();

struct A {
  virtual void f (int, ...) {}
  int i;
};

struct B : virtual public A {
};

struct C : public B {
  C ();
  virtual void f (int, ...);
};

extern C* cp;

C::C () { cp = this; }

void C::f (int i, ...) {
  if (this != cp)
    abort ();
  va_list ap;
  if (i != 3)
    abort ();
  va_start (ap, i);
  if (va_arg (ap, int) != 7)
    abort ();
  va_end (ap);
}

C* cp = new C;

int main () 
{
  cp->f (3, 7);
}