OSDN Git Service

PR c++/51613
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jan 2012 16:46:57 +0000 (16:46 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jan 2012 16:46:57 +0000 (16:46 +0000)
* pt.c (resolve_overloaded_unification): Compare types with
same_type_p, not decls_match.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183099 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9b080fb..537d1aa 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 bc3dd97..ac72b6d 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 4fafc8a..5ac78a5 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;
+}