Report errors for member functions correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81063 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index b487083..97b58ad 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -293,7 +293,6 @@
     case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation: {
       ParmVarDecl *Param = cast<ParmVarDecl>((Decl *)Active->Entity);
       FunctionDecl *FD = cast<FunctionDecl>(Param->getDeclContext());
-      TemplateDecl *Template = FD->getPrimaryTemplate();
       
       std::string TemplateArgsStr
         = TemplateSpecializationType::PrintTemplateArgumentList(
@@ -302,7 +301,7 @@
                                                       Context.PrintingPolicy);
       Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
                    diag::note_default_function_arg_instantiation_here)
-        << (Template->getNameAsString() + TemplateArgsStr)
+        << (FD->getNameAsString() + TemplateArgsStr)
         << Active->InstantiationRange;
       break;
     }
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 5c95e51..925d52f 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -21,6 +21,7 @@
 
 template<typename T> struct F {
   F(T t = 10);
+  void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
 };
 
 struct FD : F<int> { };
@@ -30,6 +31,11 @@
   FD fd;
 }
 
+void g3(F<int> f, F<struct S> s) {
+  f.f();
+  s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}}
+}
+
 template<typename T> struct G {
   G(T) {}
 };
@@ -37,3 +43,4 @@
 void s(G<int> flags = 10) { }
 
 
+