Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.jason / thunk3.C
blob1b235ef58e9ceb409e50c7da14b51a3fdf2594e7
1 // { dg-do run { xfail rs6000-*-* powerpc-*-eabi m68k-*-coff mn10300-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* m32r*-*-* } }
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;