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

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---

fold_non_dependent_expr folds a constexpr variable's initialiser inside a
template (at parse time) by calling tsubst_expr with null args. 

An initialiser can legitimately contain sub-trees folded outside any template —
an NSDMI from digest_init — but tsubst_expr asserts those cannot appear - thus
folding ICEs on the NSDMI (PR102990, PR126811).

The trouble is that not folding leaves template-only nodes such as
MPLICIT_CONV_EXPR to reach constant evaluation, which ICEs there instead.

The intent of bailing early here was to avoid having to inspect inside tsubst -
but the consequence (PR127395, PR127439) is needing to do more work in
constexpr, which is probably not ideal given the increasing amount of
constexpr.

Finally, there is no single-point-of-action since we can have CONSTRUCTORs with
both folded NSDMI and IMPLICIT_CONV_EXPR;

The current approach under test is to determine the relevant allowed case in
tsubst and to revert the change applied for this fix.
(patch is under test, will attach once done).

Reply via email to