Merge to HEAD at tree-cleanup-merge-20041024 .
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / thunk2.C
blob5694fa1b27007143a7356db6cbe07de69ebe5662
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.
6 struct A {
7   void* p;
8   A (void* q): p (q) { }
9   A (const A& a): p (a.p) { }
12 class CBase {
13 public:
14   virtual void BaseFunc();
17 class MMixin {
18 public:
19    virtual A MixinFunc(int arg, A arg2) = 0;
22 class CExample : public CBase, public MMixin {
23 public:
24    A MixinFunc(int arg, A arg2);
27 void CBase::BaseFunc()
31 A CExample::MixinFunc(int arg, A arg2)
33   if (arg != 1 || arg2.p != 0)
34     return 0;
35   return this;
38 void* test(MMixin& anExample)
40   return anExample.MixinFunc(1,A(0)).p;
43 main ()
45   CExample c;
47   if (test(c) != &c)
48     return 1;