[Bug c++/123566] [16 Regression] ICE in finish_expr_stmt, at cp/semantics.cc:1171 since r16-6352 with a local type defined in a lambda as a default template argument

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 23 11:33:51 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123566

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE is because
cp_finish_decl on s during tsubst_lambda_expr calls
check_initializer -> build_aggr_init_full_exprs -> build_aggr_init ->
expand_aggr_init_1 -> expand_default_init -> build_special_member_call
attempts to lookup default ctor but doesn't find it.
Note, even trying to print that lambda type ICEs,
this time on dump_template_decl
1750              if (len == 0)
1751                {
1752                  /* Skip over the dummy template levels of a template
template
1753                     parm.  */
1754                  gcc_assert (TREE_CODE (TREE_TYPE (t)) ==
TEMPLATE_TEMPLATE_PARM);
1755                  continue;
1756                }
where TREE_CODE (TREE_TYPE (t)) is RECORD_TYPE.


More information about the Gcc-bugs mailing list