summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.abi/empty.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.abi/empty.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.abi/empty.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.abi/empty.C69
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.abi/empty.C b/gcc/testsuite/g++.old-deja/g++.abi/empty.C
new file mode 100644
index 000000000..40aac9e9d
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.abi/empty.C
@@ -0,0 +1,69 @@
+// { dg-do run }
+// { dg-options "-w" }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+
+struct S0
+{
+};
+
+struct S1 : public S0
+{
+};
+
+struct S2 : public S1
+{
+ char c;
+};
+
+// In S3, the S1 instance is allocated first at offset zero. The S2
+// instance has to be allocated at a subsequent offset; it's first
+// part is also an S1.
+
+struct S3 : public S1, public S2
+{
+};
+
+struct S4
+{
+ int i;
+};
+
+// In S4, in contrast to S3, S2 is allocated first, and S1 can be
+// allocated on top of S4.
+
+struct S5 : public S2, public S1, public S4
+{
+};
+
+// The T classes are by-hand layouts that should be equivalent to the
+// S classes.
+
+struct T3
+{
+ S1 s1;
+ S2 s2;
+};
+
+struct T5
+{
+ S2 s2;
+ S4 s4;
+};
+
+int main ()
+{
+ if (sizeof (S3) != sizeof (T3))
+ return 1;
+ else if (sizeof (S5) != sizeof (T5))
+ return 2;
+}
+
+#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
+
+int main ()
+{
+}
+
+#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */