https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118340

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #5)
> FWIW disabling the block containing the cp_fully_fold calls breaks
> g++.dg/cpp0x/warn-ovl2.C and g++.dg/warn/multiple-overflow-warn-3.C,
> unsurprisingly.
> 
> We can't leverage the fold_cache here because cp_fold only evaluates
> constexpr calls if !flag_no_inline, but here we want to evaluate calls even
> at -O0.  And we can't leverage the cv_cache either because it's not
> recursive.

Perhaps cv_cache should cache intermediate values that are themselves
constant-expressions, or at least look up intermediate values that might have
previously been passed to maybe_constant_value, as in this case.

Incidentally, it seems like some of those cp_fully_fold calls should instead be
fold_for_warn?

Reply via email to