aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-14 22:02:01 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-14 22:02:01 +0000
commitd173b207a032b39d35727877fc794aa2f52dc290 (patch)
tree92ba37f1b1b4f7500ea7d8b9662abe0984467499
parent06c9cb4d1a29e708f51bce9f7ee5acbe1c3761c3 (diff)
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
-rw-r--r--lib/Sema/SemaOverload.cpp2
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 3e89a6413a..ce004b8d05 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4062,7 +4062,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
// 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 9c9f0e19ef..e49b477612 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -23,7 +23,22 @@ int g1(char);
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);
}