PR c++/80290
[official-gcc.git] / gcc / testsuite / g++.dg / opt / thunk1.C
blob566c0f2fcc5d8e7ce6a9d0c290e63aa94c2b0570
1 // PR 6788
2 // Test that the thunk adjusts the this pointer properly.
3 // { dg-do run }
5 extern "C" void abort ();
7 struct A
9   virtual void foo() = 0;
10   char large[33*1024];
13 struct B
15   virtual void foo() = 0;
18 struct C : public A, public B
20   virtual void foo();
23 static C *match;
25 void C::foo()
27   if (this != match)
28     abort ();
31 void bar(B *x)
33   x->foo();
36 int main()
38   C obj;
39   match = &obj;
40   bar(&obj);
41   return 0;