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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:4e4684ca6a79b22fe91acaa81af2d4a00d6e1345

commit r15-9807-g4e4684ca6a79b22fe91acaa81af2d4a00d6e1345
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Jun 4 13:31:02 2025 -0400

    c++: constexpr prvalues vs genericize [PR120502]

    Here constexpr evaluation was getting confused by the result of
    split_nonconstant_init, which leaves an INIT_EXPR from an empty CONSTRUCTOR
    to be followed by member initialization.  As a result
    CONSTRUCTOR_NO_CLEARING was set for the time_zone, and
    cxx_eval_store_expression didn't set it again for the initial clobber in
the
    basic_string constructor, so when cxx_fold_indirect_ref wants to check
    whether the anonymous union active member had type non_trivial_if, we see
    that we don't currently have a value for the anonymous union, try to add
    one, and fail.

    So let's do constexpr evaluation before split_nonconstant_init.

            PR c++/120502

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Do constexpr evaluation
            before genericize.
            * constexpr.cc (cxx_eval_store_expression): Add comment.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/constexpr-prvalue2.C: New test.

Reply via email to