re PR c++/51613 (Ambiguous function template instantiations as template argument are not rejected)

PR c++/51613
	* pt.c (resolve_overloaded_unification): Compare types with
	same_type_p, not decls_match.

From-SVN: r183099
This commit is contained in:
Jason Merrill 2012-01-11 11:46:57 -05:00 committed by Jason Merrill
parent 145f71b5ec
commit 7bb37352be
4 changed files with 36 additions and 1 deletions

View 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

View 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;

View 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.

View File

@ -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;
}