[Bug c++/126811] [14/15/16/17 Regression] c++: ICE in tsubst when a constexpr init contains an NSDMI

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126811

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=102990

--- Comment #4 from Drea Pinski <pinskia at gcc dot gnu.org> ---
the patch that fixed PR 102990 might give a hint of what is going on:
In a template, we should never create a FIX_TRUNC_EXPR (that's what
    conv_unsafe_in_template_p is for).  But in this test we are NOT in
    a template when we call digest_nsdmi_init which ends up calling
    convert_like, converting 1.0e+0 to int, so convert_to_integer_1
    gives us a FIX_TRUNC_EXPR.

    But then when we get to parsing f's parameters, we are in a template
    when processing decltype(Helpers{}), and since r268321, when the
    compound literal isn't instantiation-dependent and the type isn't
    type-dependent, finish_compound_literal falls back to the normal
    processing, so it calls digest_init, which does fold_non_dependent_init
    and since the FIX_TRUNC_EXPR isn't dependent, we instantiate and
    therefore crash in tsubst_copy_and_build.

    The fateful call to fold_non_dependent_init comes from massage_init_elt,
    We shouldn't be calling f_n_d_i on the result of get_nsdmi.  This we can
    avoid by eschewing calling f_n_d_i on CONSTRUCTORs; their elements have
    already been folded.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.