diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-01-13 21:59:13 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-01-14 10:14:25 +0000 |
commit | fc6f1128ae603164aea6303ce2b3ed0b57e6a378 (patch) | |
tree | 24e5f5da306c6f704772567d604faf1954daa2c1 /libstdc++-v3/include/std/version | |
parent | d67ba1dce9796bff177e52e2bbb68bfa2c69a884 (diff) | |
download | gcc-fc6f1128ae603164aea6303ce2b3ed0b57e6a378.zip gcc-fc6f1128ae603164aea6303ce2b3ed0b57e6a378.tar.gz gcc-fc6f1128ae603164aea6303ce2b3ed0b57e6a378.tar.bz2 |
libstdc++: Ignore cv-quals when std::allocator<void> constructs
When I added the std::allocator_traits<std::allocator<void>>
specialization it broke code like this:
std::allocate_shared<const int>(std::allocator<void>());
The problem is that allocator_traits<allocator<void>>::construct(a, p)
now uses std::_Construct(p), which only does a static_cast<void*>(p) and
so fails if the pointer has cv-quals.
This changes std::_Construct (and the related std::_Construct_novalue)
to use a C-style cast to (void*) which matches the effects of the
"voidify" helper in the C++20 standard.
libstdc++-v3/ChangeLog:
* include/bits/stl_construct.h (_Construct, _Construct_novalue):
Also cast away cv-qualifiers when converting pointer to void.
* testsuite/20_util/allocator/void.cc: Test construct function
with cv-qualified types.
Diffstat (limited to 'libstdc++-v3/include/std/version')
0 files changed, 0 insertions, 0 deletions