aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi/layout2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/abi/layout2.C')
-rw-r--r--gcc/testsuite/g++.dg/abi/layout2.C33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/layout2.C b/gcc/testsuite/g++.dg/abi/layout2.C
new file mode 100644
index 00000000000..fb4e1e5d9ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/layout2.C
@@ -0,0 +1,33 @@
+// Red Hat bugzilla 65210
+// { dg-do run }
+
+struct A {
+ int a;
+};
+
+struct B : public virtual A {};
+
+struct C {
+ long double c;
+};
+
+struct D : public virtual C {
+ int d;
+};
+
+struct E : public B, public D {
+ int e;
+};
+
+E e;
+
+/* The layout of E should begin with the B-in-E vtable pointer, followed by
+ the D-in-E vtable pointer. The bug was that we used to pad out the D
+ fields for long double alignment. */
+
+int main ()
+{
+ D* dp = &e;
+ unsigned long d_offset = ((char*)dp) - ((char*) &e);
+ return (d_offset != sizeof(void *));
+}