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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:2ce99c0088ed97991f61cbdefa83f682c2ef4364

commit r15-6272-g2ce99c0088ed97991f61cbdefa83f682c2ef4364
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Sun Dec 8 14:34:01 2024 +0000

    libstdc++: Fix fancy pointer support in linked lists [PR57272]

    The union members I used in the new _Node types for fancy pointers only
    work for value types that are trivially default constructible. This
    change replaces the anonymous union with a named union so it can be
    given a default constructor and destructor, to leave the variant member
    uninitialized.

    This also fixes the incorrect macro names in the alloc_ptr_ignored.cc
    tests as pointed out by François, and fixes some std::list pointer
    confusions that the fixed alloc_ptr_ignored.cc test revealed.

    libstdc++-v3/ChangeLog:

            PR libstdc++/57272
            * include/bits/forward_list.h (__fwd_list::_Node): Add
            user-provided special member functions to union.
            * include/bits/stl_list.h (__list::_Node): Likewise.
            (_Node_base::_M_hook, _Node_base::swap): Use _M_base() instead
            of std::pointer_traits::pointer_to.
            (_Node_base::_M_transfer): Likewise. Add noexcept.
            (_List_base::_M_put_node): Use 'if constexpr' to avoid using
            pointer_traits::pointer_to when not necessary.
            (_List_base::_M_destroy_node): Fix parameter to be the pointer
            type used internally, not the allocator's pointer.
            (list::_M_create_node): Likewise.
            *
testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr.cc:
            Check explicit instantiation of non-trivial value type.
            *
testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr.cc:
            Likewise.
            *
testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr_ignored.cc:
            Fix macro name.
            *
testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr_ignored.cc:
            Likewise.

Reply via email to