]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix std::allocator<void> for versioned namespace
authorJonathan Wakely <jwakely@redhat.com>
Sat, 28 Aug 2021 10:05:58 +0000 (11:05 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 28 Aug 2021 13:37:19 +0000 (14:37 +0100)
commit754fca77e82a59d85c735a5aff49ee2b1ec4c6df
tree0b66441f995e6bc728a2714c027be484b3f5dd22
parentdd3e5859fc16701acb73f59220c8c964af9f713b
libstdc++: Fix std::allocator<void> for versioned namespace

Removing the allocator<void> specialization for the versioned namespace
breaks _Extptr_allocator<void> because the allocator<void>
specialization was still declared in <bits/memoryfwd.h>, making it an
incomplete type.  It wrong to remove that specialization anyway, because
it is still needed pre-C++20.

This removes the #if ! _GLIBCXX_INLINE_VERSION check, so that
allocator<void> is still explicitly specialized for the versioned
namespace, consistent with the normal unversioned namespace mode.

To make _Extptr_allocator<void> usable as a ProtoAllocator, this change
adds a default constructor and converting constructor. That is
consistent with std::allocator<void> since C++20 (and harmless to do for
earlier standards).

I'm also explicitly specializing allocator_traits<allocator<void>> so
that it doesn't need to use allocator<void>::construct and destroy.
Doing that allows those members to be removed, further simplifying
allocator<void>.  That new explicit specialization can delete the
allocate, deallocate and max_size members, which are always ill-formed
for allocator<void>.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/alloc_traits.h (allocator_traits): Add explicit
specialization for allocator<void>. Improve doxygen comments.
* include/bits/allocator.h (allocator<void>): Restore for the
versioned namespace.
(allocator<void>::construct, allocator<void>::destroy): Remove.
* include/ext/extptr_allocator.h (_Extptr_allocator<void>):
Add default constructor and converting constructor.
libstdc++-v3/include/bits/alloc_traits.h
libstdc++-v3/include/bits/allocator.h
libstdc++-v3/include/ext/extptr_allocator.h
This page took 0.059459 seconds and 6 git commands to generate.