Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp	(revision 230135)
+++ lib/Sema/SemaDecl.cpp	(working copy)
@@ -6482,8 +6482,17 @@
   SmallVector<std::pair<FunctionDecl *, unsigned>, 1> NearMatches;
   TypoCorrection Correction;
   bool IsDefinition = ExtraArgs.D.isFunctionDefinition();
-  unsigned DiagMsg = IsLocalFriend ? diag::err_no_matching_local_friend
-                                   : diag::err_member_decl_does_not_match;
+  bool IsTemplatePartialSpec = ExtraArgs.TemplateParamLists.size() > 0 &&
+                               Previous.getResultKind() != LookupResult::NotFound;
+  
+  unsigned DiagMsg = 0;
+  if (IsLocalFriend)
+    DiagMsg = diag::err_no_matching_local_friend;
+  else if (IsTemplatePartialSpec)
+    DiagMsg = diag::err_function_template_partial_spec;
+  else
+    DiagMsg = diag::err_member_decl_does_not_match;
+  
   LookupResult Prev(SemaRef, Name, NewFD->getLocation(),
                     IsLocalFriend ? Sema::LookupLocalFriendName
                                   : Sema::LookupOrdinaryName,
@@ -6578,8 +6587,14 @@
     Previous.setLookupName(Name);
   }
 
-  SemaRef.Diag(NewFD->getLocation(), DiagMsg)
+  if (IsTemplatePartialSpec) {
+    TemplateParameterList* TemplateParams = ExtraArgs.TemplateParamLists[0];
+    SemaRef.Diag(TemplateParams->getTemplateLoc(), DiagMsg)
+      << SourceRange(TemplateParams->getLAngleLoc(), TemplateParams->getRAngleLoc());
+  } else {
+    SemaRef.Diag(NewFD->getLocation(), DiagMsg)
       << Name << NewDC << IsDefinition << NewFD->getLocation();
+  }
 
   bool NewFDisConst = false;
   if (CXXMethodDecl *NewMD = dyn_cast<CXXMethodDecl>(NewFD))
@@ -7684,14 +7699,14 @@
           // Complain about this problem, and attempt to suggest close
           // matches (e.g., those that differ only in cv-qualifiers and
           // whether the parameter types are references).
-
+          
           if (NamedDecl *Result = DiagnoseInvalidRedeclaration(
                   *this, Previous, NewFD, ExtraArgs, false, nullptr)) {
             AddToScope = ExtraArgs.AddToScope;
             return Result;
           }
         }
-
+        
         // Unqualified local friend declarations are required to resolve
         // to something.
       } else if (isFriend && cast<CXXRecordDecl>(CurContext)->isLocalClass()) {
