From 36fd6beef1ffaf93217d8ce96d900d4ed817e463 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 20 Apr 2010 16:22:16 +0000 Subject: 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 --- test/CodeGenCXX/vtable-pointer-initialization.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/CodeGenCXX/vtable-pointer-initialization.cpp') 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() { } +} -- cgit v1.2.3-70-g09d2