aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/vtable-pointer-initialization.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-20 16:22:16 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-20 16:22:16 +0000
commit36fd6beef1ffaf93217d8ce96d900d4ed817e463 (patch)
tree23f7f9f4744507e22b022889ddd19d458edaf431 /test/CodeGenCXX/vtable-pointer-initialization.cpp
parent9dc228a1b971aa884766a9bdfdf5fa8ee4730b5b (diff)
Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-pointer-initialization.cpp')
-rw-r--r--test/CodeGenCXX/vtable-pointer-initialization.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-pointer-initialization.cpp b/test/CodeGenCXX/vtable-pointer-initialization.cpp
index 75620ab8e6..ca8fb9be88 100644
--- a/test/CodeGenCXX/vtable-pointer-initialization.cpp
+++ b/test/CodeGenCXX/vtable-pointer-initialization.cpp
@@ -55,3 +55,23 @@ void f() { B b; }
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 0, i64 2)
// CHECK: call void @_ZN5FieldC1Ev
// CHECK: ret void
+
+namespace Test1 {
+
+// Test that we don't assert when initializing the vtable pointers in C.
+struct A {
+ virtual void a();
+ int i;
+};
+
+struct B : virtual A {
+ virtual void b();
+};
+
+struct C : A, virtual B {
+ virtual void c();
+ C();
+};
+
+C::C() { }
+}