https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88869
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Note the auto return type on foo isn't important, it ICEs even with void foo () { C ([] {}); } The ICE is in 26858 tparms = DECL_TEMPLATE_PARMS (fn_tmpl); 26859 /* If type is a member class template, DECL_TI_ARGS (ctor) will have 26860 fully specialized args for the enclosing class. Strip those off, as 26861 the deduction guide won't have those template parameters. */ 26862 targs = get_innermost_template_args (DECL_TI_ARGS (ctor), 26863 TMPL_PARMS_DEPTH (tparms)); because tparms is NULL.