aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/vtable-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-25 22:18:35 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-25 22:18:35 +0000
commitbf554f63bffa7db32b5f343f6fd075501b97d401 (patch)
tree6bed498fc683015d1823303b8cf64e8caa70ccf7 /test/CodeGenCXX/vtable-layout.cpp
parent9ad1c0205ec478d64b3ed6d3dde5efaa9c9932c5 (diff)
Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index efd0d2f7bc..c22222f9ce 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -510,3 +510,32 @@ void C::f() { }
}
+namespace Test14 {
+
+// Verify that we handle A being a non-virtual base of B, which is a virtual base.
+
+struct A {
+ virtual void f();
+};
+
+struct B : A { };
+
+struct C : virtual B { };
+
+// CHECK: Vtable for 'Test14::D' (5 entries).
+// CHECK-NEXT: 0 | vbase_offset (0)
+// CHECK-NEXT: 1 | vcall_offset (0)
+// CHECK-NEXT: 2 | offset_to_top (0)
+// CHECK-NEXT: 3 | Test14::D RTTI
+// CHECK-NEXT: -- (Test14::A, 0) vtable address --
+// CHECK-NEXT: -- (Test14::B, 0) vtable address --
+// CHECK-NEXT: -- (Test14::C, 0) vtable address --
+// CHECK-NEXT: -- (Test14::D, 0) vtable address --
+// CHECK-NEXT: 4 | void Test14::D::f()
+struct D : C, virtual B {
+ virtual void f();
+};
+void D::f() { }
+
+}
+