https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112632
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:5ee5a05da06078975a933be849431eee1d4c6989 commit r16-4211-g5ee5a05da06078975a933be849431eee1d4c6989 Author: Jason Merrill <[email protected]> Date: Fri Oct 3 18:10:36 2025 +0100 c++: concepts and conversions, take 2 [PR122127] My r16-4115 changed convert_template_argument (when called from instantiate_alias_template) to take the maybe_convert_nontype_argument path rather than convert_nontype_argument for this testcase. This meant not folding the use of the by-ref capture in the template argument to constant 1. When we come back to convert_template_argument again when substituting into resize<_Np> we strip the IMPLICIT_CONV_EXPR (since the types are the same) and take the convert_nontype_argument path, but at this point we've pushed into the alias template context and trying to fold away the capture fails because current_lambda_expr() is now null. Taking the convert_nontype_argument path in the same-type case where we would later strip an IMPLICIT_CONV_EXPR fixes the problem. Note that maybe_convert_nontype_argument already shares the same-type check with the stripping, but that isn't enough; it still doesn't fold away the capture proxy. PR c++/122127 PR c++/112632 gcc/cp/ChangeLog: * pt.cc (convert_template_argument): Don't add redundant IMPLICIT_CONV_EXPR. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-template18.C: New test.
