From: No Author Date: Sun, 26 May 2002 02:42:21 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch X-Git-Tag: releases/gcc-3.1.1~267 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9367b042b500d235673bb1243998f1f302f3914;p=thirdparty%2Fgcc.git This commit was manufactured by cvs2svn to create branch 'gcc-3_1-branch'. From-SVN: r53882 --- diff --git a/gcc/testsuite/g++.dg/opt/thunk1.C b/gcc/testsuite/g++.dg/opt/thunk1.C new file mode 100644 index 000000000000..566c0f2fcc5d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/thunk1.C @@ -0,0 +1,42 @@ +// PR 6788 +// Test that the thunk adjusts the this pointer properly. +// { dg-do run } + +extern "C" void abort (); + +struct A +{ + virtual void foo() = 0; + char large[33*1024]; +}; + +struct B +{ + virtual void foo() = 0; +}; + +struct C : public A, public B +{ + virtual void foo(); +}; + +static C *match; + +void C::foo() +{ + if (this != match) + abort (); +} + +void bar(B *x) +{ + x->foo(); +} + +int main() +{ + C obj; + match = &obj; + bar(&obj); + return 0; +}