https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117350
--- Comment #16 from ak at gcc dot gnu.org --- I'm not sure the revision in the subject is right. Given the reproduction in gcc 13 it seems to me this is a latent bug that is just triggered by changes in the bootstrapped input source. Strangely it is now triggered by at least two places, so something else might have changed. The initial failure comes from this assert failing 1194 /* If not, it should be either in the global namespace, or directly 1195 in a local function scope. A lambda can also be mangled in the 1196 scope of a default argument. */ 1197 gcc_assert (context == global_namespace 1198 || TREE_CODE (context) == PARM_DECL 1199 || TREE_CODE (context) == FUNCTION_DECL); When i look at it in rr I see (rr) p context $5 = <record_type 0x7fc0883e40a8 unique_ptr> (rr) p decl $7 = <template_decl 0x7fc0883dd980 __ct > This doesn't look like garbage from freed data, more some logic problem.