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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:07b05ad02478dc3291a234ebd2030f49e0259673

commit r17-4659-g07b05ad02478dc3291a234ebd2030f49e0259673
Author: Jakub Jelinek <[email protected]>
Date:   Fri Sep 25 17:55:51 2026 +0200

    c++: Represent aggregate subobjects after std::destroy_at as void_node
[PR127385]

    The following testcase misbehaves, because for std::destroy_at of
aggregates
    (i.e. CLOBBER with CLOBBER_OBJECT_END) we record during constant evaluation
    just a normal CONSTRUCTOR, so for std::is_within_lifetime it appears as if
    it is normally within lifetime, even when it is not.

    For scalar subobjects and complete objects we use void_node, this patch
    uses void_node also for the aggregates (but doesn't do that on
    CLOBBER_OBJECT_START and CLOBBER_STORAGE_START, that breaks too much stuff
    and the lifetime is just beginning there, not ending).  I've just had
    to tweak cxx_eval_store_expression so that it is able to handle stores
    into previously outside of lifetime subobjects by making those within
    lifetime.

    2026-09-25  Jakub Jelinek  <[email protected]>

            PR c++/127385
            * constexpr.cc (cxx_eval_store_expression): Handle the case
            of *valp == void_node like if *valp is NULL.
            (cxx_eval_store_expression): For CLOBBER_OBJECT_END or above
            store *valp = void_node even for aggregate types.

            * g++.dg/cpp26/within-lifetime14.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to