summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-03-24 22:43:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-03-24 22:43:31 +0000
commit1dbd474f2e097ba2a7dbb3db10414baebee9bd02 (patch)
tree1a347cc0fc54ea5ade9c6be0cff702685d4313e1
parent8edc6dfd200f701c7c8e284d7976606f98bbe40a (diff)
downloadbcm5719-llvm-1dbd474f2e097ba2a7dbb3db10414baebee9bd02.tar.gz
bcm5719-llvm-1dbd474f2e097ba2a7dbb3db10414baebee9bd02.zip
Discussing with dgregor we decided that we should not force the emission of
implicit methods on explicit template instantiation definitions. As a consequence, we should emit them at every use, even if we see a explicit template instantiation declaration. This is already the current behaviour, but it is good to test for that :-) llvm-svn: 99443
-rw-r--r--clang/test/CodeGenCXX/template-instantiation.cpp (renamed from clang/test/CodeGenCXX/PR6677.cpp)29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/PR6677.cpp b/clang/test/CodeGenCXX/template-instantiation.cpp
index 8d168f11060..9e0593998bb 100644
--- a/clang/test/CodeGenCXX/PR6677.cpp
+++ b/clang/test/CodeGenCXX/template-instantiation.cpp
@@ -3,6 +3,10 @@
// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = constant
+// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(
+// CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_(
+// CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd(
+
namespace test0 {
struct basic_streambuf {
virtual ~basic_streambuf();
@@ -31,3 +35,28 @@ namespace test1 {
// Just a declaration should not force the vtable to be emitted.
template<> void stdio_sync_filebuf<wchar_t>::xsgetn();
}
+
+namespace test2 {
+ template<typename T1>
+ class C {
+ virtual ~C();
+ void zedbar(double) {
+ }
+ template<typename T2>
+ void foobar(T2 foo) {
+ }
+ };
+ extern template class C<int>;
+ void g() {
+ // The extern template declaration should not prevent us from producing
+ // the implicit constructor (test at the top).
+ C<int> a;
+
+ // or foobar(test at the top).
+ a.foobar(0.0);
+
+ // But it should prevent zebbar
+ // (test at the top).
+ a.zedbar(0.0);
+ }
+}
OpenPOWER on IntegriCloud