Avoid producing implicit methods when we have a explicit template instantiation
declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99311 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/PR6677.cpp b/test/CodeGenCXX/PR6677.cpp
index 8d168f1..29c737c 100644
--- a/test/CodeGenCXX/PR6677.cpp
+++ b/test/CodeGenCXX/PR6677.cpp
@@ -3,6 +3,9 @@
 // CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
 // CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = constant
 
+// CHECK: define linkonce_odr void @_ZN5test21CIiE5fobarIdEEvT_
+// CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd
+
 namespace test0 {
   struct  basic_streambuf   {
     virtual       ~basic_streambuf();
@@ -13,7 +16,12 @@
   };
 
   // This specialization should cause the vtable to be emitted, even with
-  // the following extern template declaration.
+  // the following extern template declaration (test at the top).
+
+  // The existance of the extern template declaration should prevent us from emitting
+  // destructors.
+  // CHECK: define available_externally void @_ZN5test018stdio_sync_filebufIwED0Ev
+  // CHECK: define available_externally void @_ZN5test018stdio_sync_filebufIwED2Ev
   template<> void stdio_sync_filebuf<wchar_t>::xsgetn()  {
   }
   extern template class stdio_sync_filebuf<wchar_t>;
@@ -28,6 +36,30 @@
     virtual void      xsgetn();
   };
 
-  // Just a declaration should not force the vtable to be emitted.
+  // Just a declaration should not force the vtable to be emitted
+  // (test at the top).
   template<> void stdio_sync_filebuf<wchar_t>::xsgetn();
 }
+
+namespace test2 {
+  template<typename T1>
+  class C {
+    void zedbar(double) {
+    }
+    template<typename T2>
+    void fobar(T2 foo) {
+    }
+  };
+  extern template class C<int>;
+  void g() {
+    C<int> a;
+    // The extern template declaration should not prevent us from producing
+    /// foobar.
+    // (test at the top).
+    a.fobar(0.0);
+
+    // But it should prevent zebbar
+    // (test at the top).
+    a.zedbar(0.0);
+  }
+}