summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/virtual-bases.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-29 19:49:09 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-29 19:49:09 +0000
commite47380fb193ec4db782990400197debb745ad3fe (patch)
treea5963b885b85bbffd1d995296afba4837cbf4d90 /clang/test/CodeGenCXX/virtual-bases.cpp
parentac031880affc08f529c1f67d891d6b64c4be44cd (diff)
downloadbcm5719-llvm-e47380fb193ec4db782990400197debb745ad3fe.tar.gz
bcm5719-llvm-e47380fb193ec4db782990400197debb745ad3fe.zip
When collecting virtual bases it's very important to use the canonical type of the base class. Otherwise, we might add the same virtual base class twice if the virtual base is an instantiated template. Fixes PR6251.
llvm-svn: 99829
Diffstat (limited to 'clang/test/CodeGenCXX/virtual-bases.cpp')
-rw-r--r--clang/test/CodeGenCXX/virtual-bases.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/virtual-bases.cpp b/clang/test/CodeGenCXX/virtual-bases.cpp
index 62771757630..61de3153fd5 100644
--- a/clang/test/CodeGenCXX/virtual-bases.cpp
+++ b/clang/test/CodeGenCXX/virtual-bases.cpp
@@ -23,3 +23,26 @@ struct C : virtual A {
// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
C::C(bool) { }
+
+// PR6251
+namespace PR6251 {
+
+// Test that we don't call the A<char> constructor twice.
+
+template<typename T>
+struct A { A(); };
+
+struct B : virtual A<char> { };
+struct C : virtual A<char> { };
+
+struct D : B, C {
+ D();
+};
+
+// CHECK: define void @_ZN6PR62511DC1Ev
+// CHECK: call void @_ZN6PR62511AIcEC2Ev
+// CHECK-NOT: call void @_ZN6PR62511AIcEC2Ev
+// CHECK: ret void
+D::D() { }
+
+}
OpenPOWER on IntegriCloud