From a9bb583cacb289f164112c17bef602772bd8f447 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 31 Jan 2014 15:55:46 +0000 Subject: [PATCH] PR c++/57043 * pt.c (fn_type_unification): Don't do DEDUCE_EXACT check during partial ordering. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@207355 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 7 +++++-- gcc/testsuite/g++.dg/template/partial15.C | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/partial15.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 92c49f9a4d3..d32d4c4f380 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-31 Jason Merrill + + PR c++/57043 + * pt.c (fn_type_unification): Don't do DEDUCE_EXACT check + during partial ordering. + 2014-01-27 Jason Merrill PR c++/54652 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1b9f3148938..ed33198dda2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14713,8 +14713,11 @@ fn_type_unification (tree fn, /* If we're looking for an exact match, check that what we got is indeed an exact match. It might not be if some template - parameters are used in non-deduced contexts. */ - if (strict == DEDUCE_EXACT) + parameters are used in non-deduced contexts. But don't check + for an exact match if we have dependent template arguments; + in that case we're doing partial ordering, and we already know + that we have two candidates that will provide the actual type. */ + if (strict == DEDUCE_EXACT && !any_dependent_template_arguments_p (targs)) { unsigned int i; diff --git a/gcc/testsuite/g++.dg/template/partial15.C b/gcc/testsuite/g++.dg/template/partial15.C new file mode 100644 index 00000000000..357bb05fa3b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial15.C @@ -0,0 +1,19 @@ +// PR c++/57043 +// { dg-do link } + +template struct complex { }; + +template +complex +pow(const complex& x, const complex& y) { return complex(); } + +template +struct promote_2 { typedef T type; }; + +template +complex::type> +pow(const complex& x, const complex& y); + +complex (*powcc)(const complex&, const complex&) = pow; + +int main() {} -- 2.11.0