[libcxx-commits] [libcxx] [libc++] LWG3187: P0591R4 reverted DR 2586 fixes to `scoped_allocator_adaptor::construct()` (PR #152424)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 6 20:52:08 PDT 2025


================
@@ -421,23 +424,30 @@ public:
 #    else
   template <class _Tp, class... _Args>
   _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Args&&... __args) {
-    __construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(), __p, std::forward<_Args>(__args)...);
+    using _OM = __outermost<outer_allocator_type>;
+    if constexpr (!uses_allocator<__remove_cv_t<_Type>, inner_allocator_type>::value) {
+      allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
+    } else if constexpr (is_constructible<_Type, allocator_arg_t, const inner_allocator_type&, _Args...>::value) {
+      allocator_traits<typename _OM::type>::construct(
+          _OM()(outer_allocator()), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...);
----------------
frederick-vs-ja wrote:

It seems sufficient to modify existing tests.

https://github.com/llvm/llvm-project/pull/152424


More information about the libcxx-commits mailing list