Only perform an implicit instantiation of a function if its template
specialization kind is TSK_ImplicitInstantiation. Previously, we would
end up implicitly instantiating functions that had explicit
specialization declarations or explicit instantiation declarations
(with no corresponding definitions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index e7b074b..3bd72d0 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6198,15 +6198,9 @@
   if (FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
     // Implicit instantiation of function templates and member functions of
     // class templates.
-    if (!Function->getBody()) {
-      // FIXME: distinguish between implicit instantiations of function
-      // templates and explicit specializations (the latter don't get
-      // instantiated, naturally).
-      if (Function->getInstantiatedFromMemberFunction() ||
-          Function->getPrimaryTemplate())
-        PendingImplicitInstantiations.push_back(std::make_pair(Function, Loc));
-    }
-
+    if (!Function->getBody() && 
+        Function->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
+      PendingImplicitInstantiations.push_back(std::make_pair(Function, Loc));
 
     // FIXME: keep track of references to static functions
     Function->setUsed(true);