diff options
author | Anders Carlsson <andersca@mac.com> | 2010-04-20 16:22:16 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-04-20 16:22:16 +0000 |
commit | 6a0227df49ca6dacb6b4899d882a9462b7231f48 (patch) | |
tree | 426f6417ccfffdde62eafd4f939e8f0dbdf4f6c7 /clang/test/CodeGenCXX/vtable-pointer-initialization.cpp | |
parent | 53cebd1ea62eee750ce825b1587058fe47136b9c (diff) | |
download | llvm-6a0227df49ca6dacb6b4899d882a9462b7231f48.zip llvm-6a0227df49ca6dacb6b4899d882a9462b7231f48.tar.gz llvm-6a0227df49ca6dacb6b4899d882a9462b7231f48.tar.bz2 |
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.
llvm-svn: 101911
Diffstat (limited to 'clang/test/CodeGenCXX/vtable-pointer-initialization.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/vtable-pointer-initialization.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-pointer-initialization.cpp b/clang/test/CodeGenCXX/vtable-pointer-initialization.cpp index 75620ab..ca8fb9b 100644 --- a/clang/test/CodeGenCXX/vtable-pointer-initialization.cpp +++ b/clang/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() { } +} |