From: Rafael Espindola Date: Wed, 24 Mar 2010 22:43:31 +0000 (+0000) Subject: Discussing with dgregor we decided that we should not force the emission of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3eaf45bf3ebef039c99c1e9efb05b477b2a07aa;p=clang 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 :-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99443 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/PR6677.cpp b/test/CodeGenCXX/template-instantiation.cpp similarity index 59% rename from test/CodeGenCXX/PR6677.cpp rename to test/CodeGenCXX/template-instantiation.cpp index 8d168f1106..9e0593998b 100644 --- a/test/CodeGenCXX/PR6677.cpp +++ b/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::xsgetn(); } + +namespace test2 { + template + class C { + virtual ~C(); + void zedbar(double) { + } + template + void foobar(T2 foo) { + } + }; + extern template class C; + void g() { + // The extern template declaration should not prevent us from producing + // the implicit constructor (test at the top). + C a; + + // or foobar(test at the top). + a.foobar(0.0); + + // But it should prevent zebbar + // (test at the top). + a.zedbar(0.0); + } +}