2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk3.C
blob9a4cffcdc56941c2400bfdf3239c324815c69d5b
1 // { dg-do run { xfail mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* } }
2 // Test that variadic function calls using thunks work right.
3 // Note that this will break on any target that uses the generic thunk
4 //  support, because it doesn't support variadic functions.
7 #include <stdarg.h>
9 struct A {
10   void* p;
11   A (void* q): p (q) { }
12   A (const A& a): p (a.p) { }
15 class CBase {
16 public:
17    virtual void BaseFunc();
20 class MMixin {
21 public:
22    virtual A MixinFunc(int arg, ...) = 0;
25 class CExample : public CBase, public MMixin {
26 public:
27    A MixinFunc(int arg, ...);
30 void CBase::BaseFunc()
34 A CExample::MixinFunc(int arg, ...)
36   va_list ap;
37   va_start (ap, arg);
39   if (arg != 1 || va_arg (ap, int) != 2 || va_arg (ap, int) != 3
40       || va_arg (ap, int) != 4 || va_arg (ap, int) != 5
41       || va_arg (ap, int) != 6 || va_arg (ap, int) != 7
42       || va_arg (ap, int) != 8 || va_arg (ap, int) != 9)
43     return 0;
44   return this;
47 void* test(MMixin& anExample)
49   return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p;
52 int main ()
54   CExample c;
56   if (test(c) != &c)
57     return 1;