https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104620
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Patrick Palka from comment #7) > IIUC as long as NON_DEPENDENT_EXPR doesn't appear inside a non-dependent > consteval call then we'll currently correctly accept/reject it ahead of > time, e.g.: Right. The problem we're hitting is that within a template we're trying to evaluate the immediate invocation inside build_over_call rather than when we return to e.g. finish_call_expr and build up the call to actually go into the template trees: if we fold_non_dependent_expr at that point instead, it should be fine. The only problem with that is that there are a bunch of places that need to be changed.