summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/virt-template-vtable.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-07-07 06:59:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-07-07 06:59:51 +0000
commit4ff9ff974cc1944cc5f38c2c808938a29f235d60 (patch)
tree096bf9679abc792f7b2aa6ef11ee7c3aed2cf7c6 /clang/test/CodeGenCXX/virt-template-vtable.cpp
parent8dda7b27eeb67cc3da883ffdc9d55fcc41d10df6 (diff)
downloadbcm5719-llvm-4ff9ff974cc1944cc5f38c2c808938a29f235d60.tar.gz
bcm5719-llvm-4ff9ff974cc1944cc5f38c2c808938a29f235d60.zip
When marking virtual functions as used for a class' vtable, mark all functions
which will appear in the vtable as used, not just those ones which were declared within the class itself. Fixes an issue reported as comment#3 in PR12763 -- we sometimes assert in codegen if we try to emit a reference to a function declaration which we've not marked as referenced. This also matches gcc's observed behavior. llvm-svn: 159895
Diffstat (limited to 'clang/test/CodeGenCXX/virt-template-vtable.cpp')
-rw-r--r--clang/test/CodeGenCXX/virt-template-vtable.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/virt-template-vtable.cpp b/clang/test/CodeGenCXX/virt-template-vtable.cpp
index 25736fd6030..a6067d62c61 100644
--- a/clang/test/CodeGenCXX/virt-template-vtable.cpp
+++ b/clang/test/CodeGenCXX/virt-template-vtable.cpp
@@ -20,3 +20,13 @@ template class A<short>;
// CHECK: @_ZTV1AIlE = weak_odr unnamed_addr constant
// CHECK: @_ZTV1AIsE = weak_odr unnamed_addr constant
// CHECK: @_ZTV1AIiE = linkonce_odr unnamed_addr constant
+
+template<class T> struct C {
+ virtual void c() {}
+};
+struct D : C<int> {
+ virtual void d();
+};
+void D::d() {}
+
+// CHECK: define {{.*}}@_ZN1CIiE1cEv(
OpenPOWER on IntegriCloud