re PR c++/57043 (converting overloaded complex function pow in C++11 is ambiguous)

PR c++/57043
	* pt.c (fn_type_unification): Don't do DEDUCE_EXACT check
	during partial ordering.

From-SVN: r207355
This commit is contained in:
Jason Merrill 2014-01-31 10:55:46 -05:00 committed by Jason Merrill
parent 5d98ea3c0a
commit c6f5b65c3b
3 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2014-01-31 Jason Merrill <jason@redhat.com>
PR c++/57043
* pt.c (fn_type_unification): Don't do DEDUCE_EXACT check
during partial ordering.
2014-01-27 Jason Merrill <jason@redhat.com>
PR c++/54652

View File

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

View File

@ -0,0 +1,19 @@
// PR c++/57043
// { dg-do link }
template<typename D> struct complex { };
template<typename Tp>
complex<Tp>
pow(const complex<Tp>& x, const complex<Tp>& y) { return complex<Tp>(); }
template<typename T, typename U>
struct promote_2 { typedef T type; };
template<typename Tp, typename Up>
complex<typename promote_2<Tp, Up>::type>
pow(const complex<Tp>& x, const complex<Up>& y);
complex<double> (*powcc)(const complex<double>&, const complex<double>&) = pow;
int main() {}