aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-06-26 22:59:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-06-26 22:59:38 -0400
commit6147a53a9cb946ab08acb0177cff29a40aee937b (patch)
tree059a3a0d5a3e138552dc289f6a8a57827ababb92 /gcc/tree-inline.c
parentb8d636f00d94a8f04a3cc32025c9263450705e9d (diff)
downloadgcc-6147a53a9cb946ab08acb0177cff29a40aee937b.zip
gcc-6147a53a9cb946ab08acb0177cff29a40aee937b.tar.gz
gcc-6147a53a9cb946ab08acb0177cff29a40aee937b.tar.bz2
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
Diffstat (limited to 'gcc/tree-inline.c')
0 files changed, 0 insertions, 0 deletions