Commit 4b55a782 by Jason Merrill Committed by Jason Merrill

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: r207345
parent af3978a1
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-31 Marek Polacek <polacek@redhat.com>
PR c/59963
......
......@@ -15740,8 +15740,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))
{
tree substed = TREE_TYPE (decl);
unsigned int i;
......
// 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() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment