1 // PR 6788
2 // Test that the thunk adjusts the this pointer properly.
3 // { dg-do run }
4 
5 extern "C" void abort ();
6 
7 struct A
8 {
9   virtual void foo() = 0;
10   char large[33*1024];
11 };
12 
13 struct B
14 {
15   virtual void foo() = 0;
16 };
17 
18 struct C : public A, public B
19 {
20   virtual void foo();
21 };
22 
23 static C *match;
24 
foo()25 void C::foo()
26 {
27   if (this != match)
28     abort ();
29 }
30 
bar(B * x)31 void bar(B *x)
32 {
33   x->foo();
34 }
35 
main()36 int main()
37 {
38   C obj;
39   match = &obj;
40   bar(&obj);
41   return 0;
42 }
43