https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118698
--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Patrick Palka from comment #8) > Started with r14-9938, though I bet before this commit it only accidentally > worked. This failure does seem to be strongly connected to that commit. When normalizing is_foo for <T>, we get to normalizing tt<decltype([]{}),T> for <T,foo>, which means substituting <T,foo> into <decltype([]{}),T>. Since r14-9938, because in_template_context is false we return the lambda unchanged, just with LAMBDA_EXPR_EXTRA_ARGS set, so the closure type still refers to the is_specialization_of tparms in its CLASSTYPE_TEMPLATE_INFO. The first failure comes in normalization caching find_template_parameters walking over the parameter mapping; any_template_parm_r walks into the TREE_TYPE of a LAMBDA_EXPR without considering EXTRA_ARGS and finds a template parm from the wrong parameter list. If I prevent that by skipping caching of lambdas, I then hit another crash in tsubst_lambda_expr during satisfaction, because add_extra_args expects dependent EXTRA_ARGS to have been set with tf_partial, but the earlier substitution correctly wasn't tf_partial, so the expectation is violated. It seems to me that the underlying issue is the "in_template_context is false"; we're normalizing a concept, that is a template context. So I guess normalize_concept_definition needs to set current_template_parms.