On Mon, Oct 21, 2019 at 01:59:38PM -0400, Jason Merrill wrote:
> I agree that cp_fold isn't the right place, since it does lowering for GCC
> internals, and consteval expansion is part of the language semantics.  So it
> should happen before constexpr body saving, as in your patch.
> 
> It seems like we want a finish_full_expression, and do consteval folding
> there (and not from finish_function).

Do we have a reasonable place to catch the full expressions?

I mean, perhaps add_stmt if stmts_are_full_exprs_p () and the spots where
unevaluated operands are handled in the patch, but an immediate invocation
is also a full-expression but for the default argument expressions we don't
know if the calls will be immediate invocation or not. 
Aren't there hundreds of other places where full expressions are handled
though?  I mean, e.g. all expressions in OpenMP/OpenACC clauses, etc.?
If the consteval evaluation is performed from this finish_full_expression,
we'd also need to *walk_subtrees = 0; if we encounter already handled full
expressions in there (e.g. statement expressions etc.).

The finish_function was just an attempt to limit the number of places where
we need to call it to a minimum.

        Jakub

Reply via email to