OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk2.C
1 // Test that non-variadic function calls using thunks and PIC work right.
2 // Skip if not native
3 // Special g++ Options: -fvtable-thunks -fPIC
4
5 struct A {
6   void* p;
7   A (void* q): p (q) { }
8   A (const A& a): p (a.p) { }
9 };
10
11 class CBase {
12 public:
13    void BaseFunc();
14 };
15
16 class MMixin {
17 public:
18    virtual A MixinFunc(int arg, A arg2) = 0;
19 };
20
21 class CExample : public CBase, public MMixin {
22 public:
23    A MixinFunc(int arg, A arg2);
24 };
25
26 void CBase::BaseFunc()
27 {
28 }
29
30 A CExample::MixinFunc(int arg, A arg2)
31 {
32   if (arg != 1 || arg2.p != 0)
33     return 0;
34   return this;
35 }
36
37 void* test(MMixin& anExample)
38 {
39   return anExample.MixinFunc(1,A(0)).p;
40 }
41
42 main ()
43 {
44   CExample c;
45
46   if (test(c) != &c)
47     return 1;
48 }