diff options
author | Jason Merrill <jason@redhat.com> | 2012-01-11 11:46:57 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-01-11 11:46:57 -0500 |
commit | 7bb37352bed918f61a537596ea8097eb399b3883 (patch) | |
tree | 529f667258c06d8b12e1b98c6ee083196a1d37c6 | |
parent | 145f71b5ecfaf5efca5689f0fa84b78a7c5c70be (diff) | |
download | gcc-7bb37352bed918f61a537596ea8097eb399b3883.zip gcc-7bb37352bed918f61a537596ea8097eb399b3883.tar.gz gcc-7bb37352bed918f61a537596ea8097eb399b3883.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/explicit-args5.C | 24 |
4 files changed, 36 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b080fb..537d1aa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bc3dd97..ac72b6d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fafc8a..5ac78a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..d6c9a57 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-args5.C @@ -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; +} |