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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

https://gcc.gnu.org/g:8e6b7c97232489557e376bdc134ad69aaeb35794

commit r16-8767-g8e6b7c97232489557e376bdc134ad69aaeb35794
Author: Jason Merrill <[email protected]>
Date:   Mon Apr 20 12:45:57 2026 -0400

    c++: std::optional reset and constexpr [PR124910]

    Constant evaluation didn't recognize that destroying _M_value made it no
    longer the active member of the anonymous union, so we were treating the
    result as containing an out-of-lifetime value.  Instead we should treat the
    union as no longer having an active member.

            PR c++/124910

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_store_expression): Ending the
            lifetime of the active member means no active member.

    gcc/testsuite/ChangeLog:

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

Reply via email to