PR c++/80290 - memory-hog with std::pair.
* pt.c (fn_type_unification): Add convs parameter.
(check_non_deducible_conversion): Remember conversion.
(check_non_deducible_conversions): New. Do checks here.
(type_unification_real): Not here. Remove flags parm.
* call.c (add_function_candidate): Make convs a parameter.
Don't recalculate the conversion if it's already set.
(add_template_candidate_real): Allocate convs here.
(good_conversion, conv_flags): New.
When the std::pair constructors got more complex to handle, it aggravated a
preexisting algorithmic problem in template overload resolution:
As part of template argument deduction in a call, once we've deduced all
the template arguments we can but before we substitute them to form an
actual declaration, for any function parameters that don't involve template
parameters we need to check that it's possible to convert the argument to
the parameter type (wg21.link/cwg1391).
As a result, we end up calculating the conversion twice: once here, and
then again in add_function_candidate as part of normal overload resolution.
Normally this isn't a big deal, but when the argument is a multiply-nested
initializer list, doubling the conversion processing at each level leads to
combinatorial explosion.
The patch for trunk avoids the duplication by remembering the conversion we
calculate at deduction time and then reusing it in overload resolution
rather than calculating it again.
From-SVN: r262172