Clean up our handling of template-ids that resolve down to a single
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127747 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index fe0d413..9955b03 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -3944,14 +3944,17 @@
   //  fooT<int>;
   
   if (FullExpr->getType() == Context.OverloadTy) {
-    if (!ResolveSingleFunctionTemplateSpecialization(FullExpr, 
-                                                     /* Complain */ false)) {
-      OverloadExpr* OvlExpr = OverloadExpr::find(FullExpr).Expression; 
-      Diag(FullExpr->getLocStart(), diag::err_addr_ovl_ambiguous)
-        << OvlExpr->getName();
-      NoteAllOverloadCandidates(OvlExpr);
+    ExprResult Fixed
+      = ResolveAndFixSingleFunctionTemplateSpecialization(FullExpr,
+                                        /*DoFunctionPointerConversion=*/false,
+                                                          /*Complain=*/true,
+                                                    FullExpr->getSourceRange(),
+                                                          QualType(),
+                                                 diag::err_addr_ovl_ambiguous);
+    if (Fixed.isInvalid())
       return ExprError();
-    }  
+    
+    FullExpr = Fixed.get();
   }