Fix warnings occured during profiledboostrap on
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk3.C
blob7e0b93afe72df37906f0a5f8966b5ea541cbaf93
1 // { dg-do run }
2 // { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* nios2-*-* } { "*" } { "" } }
3 // Test that variadic function calls using thunks work right.
4 // Note that this will break on any target that uses the generic thunk
5 //  support, because it doesn't support variadic functions.
8 #include <stdarg.h>
10 struct A {
11   void* p;
12   A (void* q): p (q) { }
13   A (const A& a): p (a.p) { }
16 class CBase {
17 public:
18    virtual void BaseFunc();
21 class MMixin {
22 public:
23    virtual A MixinFunc(int arg, ...) = 0;
26 class CExample : public CBase, public MMixin {
27 public:
28    A MixinFunc(int arg, ...);
31 void CBase::BaseFunc()
35 A CExample::MixinFunc(int arg, ...)
37   va_list ap;
38   va_start (ap, arg);
40   if (arg != 1 || va_arg (ap, int) != 2 || va_arg (ap, int) != 3
41       || va_arg (ap, int) != 4 || va_arg (ap, int) != 5
42       || va_arg (ap, int) != 6 || va_arg (ap, int) != 7
43       || va_arg (ap, int) != 8 || va_arg (ap, int) != 9)
44     return 0;
45   return this;
48 void* test(MMixin& anExample)
50   return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p;
53 int main ()
55   CExample c;
57   if (test(c) != &c)
58     return 1;