aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/class-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-05-29 19:44:50 +0000
committerAnders Carlsson <andersca@mac.com>2010-05-29 19:44:50 +0000
commit3cd09ccbb1a750a7b40593a7b0a2d95ee2a0ba0e (patch)
treec57e2a263465031160f4ae461cfeec5cb19a274a /test/SemaCXX/class-layout.cpp
parent276b491b44b473d91610432aa335927b2c7ad152 (diff)
Rework the way virtual primary bases are added when laying out classes. Instead of doing it as a separate step, we now use the BaseSubobjectInfo and use it when laying out the bases. This fixes a bug where we would either not add a primary virtual base at all, or add it at the wrong offset.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/class-layout.cpp')
-rw-r--r--test/SemaCXX/class-layout.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/class-layout.cpp b/test/SemaCXX/class-layout.cpp
index f3c75f4b27..0a968c7065 100644
--- a/test/SemaCXX/class-layout.cpp
+++ b/test/SemaCXX/class-layout.cpp
@@ -71,3 +71,17 @@ struct D : C { bool iv0 : 1; };
SA(10, sizeof(D) == 2);
}
+
+namespace Test1 {
+
+// Test that we don't assert on this hierarchy.
+struct A { };
+struct B : A { virtual void b(); };
+class C : virtual A { int c; };
+struct D : virtual B { };
+struct E : C, virtual D { };
+class F : virtual E { };
+struct G : virtual E, F { };
+
+SA(0, sizeof(G) == 24);
+}