https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119574
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- On trunk the following partial revert fixes the testcase. The backported fix for PR116567 didn't contain this optimization so I conclude that fix caused a different issue? diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 95b89f1281b..07a9564cbed 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -13740,8 +13740,7 @@ add_extra_args (tree extra, tree args, tsubst_flags_t complain, tree in_decl) gcc_assert (!TREE_PURPOSE (extra)); extra = TREE_VALUE (extra); } - gcc_checking_assert (TREE_STATIC (extra) == uses_template_parms (extra)); - if (TREE_STATIC (extra)) + if (uses_template_parms (extra)) /* This is a partial substitution into e.g. a requires-expr or lambda-expr inside a default template argument; we expect 'extra' to be a full set of template arguments for the template context, so it suffices to just