Test function template partial ordering when resolving the address of
an overloaded function (template).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81804 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 3e89a64..ce004b8 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4062,7 +4062,7 @@
     // diagnostic below. FIXME: we could perform the quadratic
     // algorithm here, pruning the result set to limit the number of
     // candidates output later.
-     RemainingMatches.append(Matches.begin(), Matches.end());
+    RemainingMatches.append(Matches.begin(), Matches.end());
   }
 
   // [...] After such eliminations, if any, there shall remain exactly one
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index 9c9f0e1..e49b477 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -23,7 +23,22 @@
 int g2(int);
 int g2(double);
 
+template<typename T> T g3(T);
+int g3(int);
+int g3(char);
+
 void g_test() {
   g(g1);
   g(g2); // expected-error{{call to 'g' is ambiguous; candidates are:}}
+  g(g3);
+}
+
+template<typename T> T h1(T);
+template<typename R, typename A1> R h1(A1);
+int h2(char);
+
+void h(int (*fp)(int));
+
+void h_test() {
+  h(h1);
 }