[cfe-commits] r81804 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/addr-of-overloaded-function.cpp

Douglas Gregor dgregor at apple.com
Mon Sep 14 15:02:01 PDT 2009


Author: dgregor
Date: Mon Sep 14 17:02:01 2009
New Revision: 81804

URL: http://llvm.org/viewvc/llvm-project?rev=81804&view=rev
Log:
Test function template partial ordering when resolving the address of
an overloaded function (template).

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=81804&r1=81803&r2=81804&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Sep 14 17:02:01 2009
@@ -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

Modified: cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp?rev=81804&r1=81803&r2=81804&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp Mon Sep 14 17:02:01 2009
@@ -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);
 }





More information about the cfe-commits mailing list