1 // { dg-do run { target fpic } } 2 // { dg-options "-fPIC" } 3 // { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } } 4 // Test that non-variadic function calls using thunks and PIC work right. 5 6 struct A { 7 void* p; AA8 A (void* q): p (q) { } AA9 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 BaseFunc()27void CBase::BaseFunc() 28 { 29 } 30 MixinFunc(int arg,A arg2)31A CExample::MixinFunc(int arg, A arg2) 32 { 33 if (arg != 1 || arg2.p != 0) 34 return 0; 35 return this; 36 } 37 test(MMixin & anExample)38void* test(MMixin& anExample) 39 { 40 return anExample.MixinFunc(1,A(0)).p; 41 } 42 43 int main()44main () 45 { 46 CExample c; 47 48 if (test(c) != &c) 49 return 1; 50 51 return 0; 52 } 53