re PR c++/51613 (Ambiguous function template instantiations as template argument...
authorJason Merrill <jason@redhat.com>
Wed, 11 Jan 2012 16:46:57 +0000 (11:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 11 Jan 2012 16:46:57 +0000 (11:46 -0500)
PR c++/51613
* pt.c (resolve_overloaded_unification): Compare types with
same_type_p, not decls_match.

From-SVN: r183099

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/explicit-args5.C [new file with mode: 0644]

index 9b080fbaeb80226f334b6f946bd0272fbaba62c3..537d1aa54731d9a02ea4109b33d75dc072533ce4 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51613
+       * pt.c (resolve_overloaded_unification): Compare types with
+       same_type_p, not decls_match.
+
 2012-01-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/51614
index bc3dd9713a96eac678cc1b502ea2cad28376e776..ac72b6ddaaa521e3736a537aac6deedd6d7aab9e 100644 (file)
@@ -15471,7 +15471,7 @@ resolve_overloaded_unification (tree tparms,
              elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE);
              if (try_one_overload (tparms, targs, tempargs, parm,
                                    elem, strict, sub_strict, addr_p, explain_p)
-                 && (!goodfn || !decls_match (goodfn, elem)))
+                 && (!goodfn || !same_type_p (goodfn, elem)))
                {
                  goodfn = elem;
                  ++good;
index 4fafc8a458569c3253d8483754cfb82bff73ca6b..5ac78a5826e344396cd69fd2e4628aab47d2fbc7 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51613
+       * g++.dg/template/explicit-args5.C: New.
+
 2012-01-11  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
 
        * gcc.c-torture/execute/20120110-1.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/template/explicit-args5.C b/gcc/testsuite/g++.dg/template/explicit-args5.C
new file mode 100644 (file)
index 0000000..d6c9a57
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/51613
+
+template<typename F, typename T>
+void apply(F f, T t)
+{
+    f(t);
+}
+
+template<typename T>
+void multi(T)
+{
+}
+
+template<typename T>
+void multi(T*)
+{
+}
+
+int main()
+{
+    apply(&multi<int>, 7);     // { dg-error "no match" }
+
+    return 0;
+}