diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-08-28 11:05:58 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-08-28 14:37:19 +0100 |
commit | 754fca77e82a59d85c735a5aff49ee2b1ec4c6df (patch) | |
tree | 0b66441f995e6bc728a2714c027be484b3f5dd22 /libstdc++-v3/include/ext | |
parent | dd3e5859fc16701acb73f59220c8c964af9f713b (diff) | |
download | gcc-754fca77e82a59d85c735a5aff49ee2b1ec4c6df.zip gcc-754fca77e82a59d85c735a5aff49ee2b1ec4c6df.tar.gz gcc-754fca77e82a59d85c735a5aff49ee2b1ec4c6df.tar.bz2 |
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.
Diffstat (limited to 'libstdc++-v3/include/ext')
-rw-r--r-- | libstdc++-v3/include/ext/extptr_allocator.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h index 7d8aaac..2dfc73e 100644 --- a/libstdc++-v3/include/ext/extptr_allocator.h +++ b/libstdc++-v3/include/ext/extptr_allocator.h @@ -176,6 +176,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef _Pointer_adapter<_Relative_pointer_impl<const void> > const_pointer; + _ExtPtr_allocator() { } + + template<typename _Up> + _ExtPtr_allocator(const _ExtPtr_allocator<_Up>&) { } + template<typename _Up> struct rebind { typedef _ExtPtr_allocator<_Up> other; }; |