]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
1b235ef58e9ceb409e50c7da14b51a3fdf2594e7
[gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk3.C
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.
5
6
7 #include <stdarg.h>
8
9 struct A {
10 void* p;
11 A (void* q): p (q) { }
12 A (const A& a): p (a.p) { }
13 };
14
15 class CBase {
16 public:
17 virtual void BaseFunc();
18 };
19
20 class MMixin {
21 public:
22 virtual A MixinFunc(int arg, ...) = 0;
23 };
24
25 class CExample : public CBase, public MMixin {
26 public:
27 A MixinFunc(int arg, ...);
28 };
29
30 void CBase::BaseFunc()
31 {
32 }
33
34 A CExample::MixinFunc(int arg, ...)
35 {
36 va_list ap;
37 va_start (ap, arg);
38
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;
45 }
46
47 void* test(MMixin& anExample)
48 {
49 return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p;
50 }
51
52 int main ()
53 {
54 CExample c;
55
56 if (test(c) != &c)
57 return 1;
58 }
This page took 0.039464 seconds and 4 git commands to generate.