aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-02-19 12:14:54 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-02-19 12:46:57 +0000
commit5f3641d0c430523d839298a6876f907523811485 (patch)
tree09c44623d9495b917c167f5a4fb534d0794801c9
parent020a03eec7054adb10396067fab69d0ace00aada (diff)
downloadgcc-5f3641d0c430523d839298a6876f907523811485.zip
gcc-5f3641d0c430523d839298a6876f907523811485.tar.gz
gcc-5f3641d0c430523d839298a6876f907523811485.tar.bz2
libstdc++: uninitialized_construct_using_allocator should use construct_at (LWG 3321)
* include/std/memory (uninitialized_construct_using_allocator): Use std::construct_at (LWG 3321).
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/include/std/memory7
2 files changed, 7 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index eb83c63..5408a89 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/memory (uninitialized_construct_using_allocator): Use
+ std::construct_at (LWG 3321).
+
* include/std/memory_resource (polymorphic_allocator::allocate_bytes)
(polymorphic_allocator::allocate_object)
(polymorphic_allocator::new_object): Add nodiscard attribute (LWG3304).
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 14aedb7..aaee6e4 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -387,9 +387,10 @@ get_pointer_safety() noexcept { return pointer_safety::relaxed; }
uninitialized_construct_using_allocator(_Tp* __p, const _Alloc& __a,
_Args&&... __args)
{
- void* __vp = const_cast<void*>(static_cast<const volatile void*>(__p));
- return ::new(__vp) _Tp(std::make_obj_using_allocator<_Tp>(__a,
- std::forward<_Args>(__args)...));
+ return std::apply([&](auto&&... __xs) {
+ return std::construct_at(__p, std::forward<decltype(__xs)>(__xs)...);
+ }, std::uses_allocator_construction_args<_Tp>(__a,
+ std::forward<_Args>(__args)...));
}
// @}