OSDN Git Service

5694fa1b27007143a7356db6cbe07de69ebe5662
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk2.C
1 // { dg-do run }
2 // { dg-options "-fPIC" }
3 // { dg-bogus "\[Uu\]nresolved symbol .(_GLOBAL_OFFSET_TABLE_|\[_.A-Za-z\]\[_.0-9A-Za-z\]*@(PLT|GOT|GOTOFF))" "PIC unsupported" { xfail *-*-netware* } 0 }
4 // Test that non-variadic function calls using thunks and PIC work right.
5
6 struct A {
7   void* p;
8   A (void* q): p (q) { }
9   A (const A& a): p (a.p) { }
10 };
11
12 class CBase {
13 public:
14   virtual void BaseFunc();
15 };
16
17 class MMixin {
18 public:
19    virtual A MixinFunc(int arg, A arg2) = 0;
20 };
21
22 class CExample : public CBase, public MMixin {
23 public:
24    A MixinFunc(int arg, A arg2);
25 };
26
27 void CBase::BaseFunc()
28 {
29 }
30
31 A CExample::MixinFunc(int arg, A arg2)
32 {
33   if (arg != 1 || arg2.p != 0)
34     return 0;
35   return this;
36 }
37
38 void* test(MMixin& anExample)
39 {
40   return anExample.MixinFunc(1,A(0)).p;
41 }
42
43 main ()
44 {
45   CExample c;
46
47   if (test(c) != &c)
48     return 1;
49 }