From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.old-deja/g++.abi/empty2.C | 136 ++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.abi/empty2.C (limited to 'gcc/testsuite/g++.old-deja/g++.abi/empty2.C') diff --git a/gcc/testsuite/g++.old-deja/g++.abi/empty2.C b/gcc/testsuite/g++.old-deja/g++.abi/empty2.C new file mode 100644 index 000000000..65d6a4594 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.abi/empty2.C @@ -0,0 +1,136 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Apr 2001 + +// Check we deal with trailing empty base classes properly + +struct A {}; +struct B1 : A {}; +struct B2 : A {}; +struct B3 : A {}; +struct B4 : A {}; +struct B5 : A {}; +struct B6 : A {}; +struct B7 : A {}; +struct B8 : A {}; + +struct C1 : B1 +{ + virtual void Foo () {} +}; +struct C2 : B1, B2 +{ + virtual void Foo () {} +}; +struct C3 : B1, B2, B3 +{ + virtual void Foo () {} +}; +struct C4 : B1, B2, B3, B4 +{ + virtual void Foo () {} +}; +struct C5 : B1, B2, B3, B4, B5 +{ + virtual void Foo () {} +}; +struct C6 : B1, B2, B3, B4, B5, B6 +{ + virtual void Foo () {} +}; +struct C7 : B1, B2, B3, B4, B5, B6, B7 +{ + virtual void Foo () {} +}; +struct C8 : B1, B2, B3, B4, B5, B6, B7, B8 +{ + virtual void Foo () {} +}; + +struct D1 : virtual C1 {}; +struct D2 : virtual C2 {}; +struct D3 : virtual C3 {}; +struct D4 : virtual C4 {}; +struct D5 : virtual C5 {}; +struct D6 : virtual C6 {}; +struct D7 : virtual C7 {}; +struct D8 : virtual C8 {}; + +unsigned const nearly_empty_size = sizeof (D1); + +template int Check (Dn const &ref) +{ + if ((sizeof (Cn) <= nearly_empty_size) + != (static_cast (&ref) + == static_cast (&ref))) + return 1; + return 0; +} + +template int Check () +{ + Cn c[2]; + + if (static_cast (static_cast (&c[1])) + == static_cast (static_cast (&c[0]))) + return 1; + return 0; +} + + +int main () +{ +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + if (Check ()) + return 1; + if (Check ()) + return 2; + if (Check ()) + return 3; + if (Check ()) + return 4; + if (Check ()) + return 5; + if (Check ()) + return 6; + if (Check ()) + return 7; + if (Check ()) + return 8; + + if (Check (D1 ())) + return 11; + if (Check (D2 ())) + return 12; + if (Check (D3 ())) + return 13; + if (Check (D4 ())) + return 14; + if (Check (D5 ())) + return 15; + if (Check (D6 ())) + return 16; + if (Check (D7 ())) + return 17; + if (Check (D8 ())) + return 18; + + if (sizeof (C2) == nearly_empty_size) + return 22; + if (sizeof (C3) == nearly_empty_size) + return 23; + if (sizeof (C4) == nearly_empty_size) + return 24; + if (sizeof (C5) == nearly_empty_size) + return 25; + if (sizeof (C6) == nearly_empty_size) + return 26; + if (sizeof (C7) == nearly_empty_size) + return 27; + if (sizeof (C8) == nearly_empty_size) + return 28; +#endif + return 0; + +} -- cgit v1.2.3