diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-12-08 14:34:01 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-12-16 14:04:45 +0000 |
commit | 2ce99c0088ed97991f61cbdefa83f682c2ef4364 (patch) | |
tree | aae79501eae174b600c734ffef9b1cc971950faf /gcc | |
parent | a895642e230456c183b80202c68a959aa4aabea6 (diff) | |
download | gcc-2ce99c0088ed97991f61cbdefa83f682c2ef4364.zip gcc-2ce99c0088ed97991f61cbdefa83f682c2ef4364.tar.gz gcc-2ce99c0088ed97991f61cbdefa83f682c2ef4364.tar.bz2 |
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.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions