diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-05-29 00:08:47 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-05-29 00:08:47 +0000 |
commit | bd2e949869cd238d5d94812007953cf6fe6f4d84 (patch) | |
tree | cd00a155c8c557fb941851e71f79b7720e157c61 /libcxx/include/experimental | |
parent | dcfcfdb0d166fff8388bdd2edc5a2948054c9da1 (diff) | |
download | bcm5719-llvm-bd2e949869cd238d5d94812007953cf6fe6f4d84.tar.gz bcm5719-llvm-bd2e949869cd238d5d94812007953cf6fe6f4d84.zip |
LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()"
Patch from Arthur O'Dwyer.
In the TS, `uses_allocator` construction for `pair` tried to use an allocator
type of `memory_resource*`, which is incorrect because `memory_resource*` is
not an allocator type. LWG 2969 fixed it to use `polymorphic_allocator` as the
allocator type instead.
https://wg21.link/lwg2969
(D47090 included this in `<memory_resource>`; at Eric's request, I've split
this out into its own patch applied to the existing
`<experimental/memory_resource>` instead.)
Reviewed as https://reviews.llvm.org/D47109
llvm-svn: 333384
Diffstat (limited to 'libcxx/include/experimental')
-rw-r--r-- | libcxx/include/experimental/memory_resource | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource index d101f3e0811..748e2e78757 100644 --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -206,7 +206,7 @@ public: void construct(_Tp* __p, _Ts &&... __args) { _VSTD_LFTS::__lfts_user_alloc_construct( - __p, resource(), _VSTD::forward<_Ts>(__args)... + __p, *this, _VSTD::forward<_Ts>(__args)... ); } @@ -218,14 +218,14 @@ public: ::new ((void*)__p) pair<_T1, _T2>(piecewise_construct , __transform_tuple( typename __lfts_uses_alloc_ctor< - _T1, memory_resource*, _Args1... + _T1, polymorphic_allocator&, _Args1... >::type() , _VSTD::move(__x) , typename __make_tuple_indices<sizeof...(_Args1)>::type{} ) , __transform_tuple( typename __lfts_uses_alloc_ctor< - _T2, memory_resource*, _Args2... + _T2, polymorphic_allocator&, _Args2... >::type() , _VSTD::move(__y) , typename __make_tuple_indices<sizeof...(_Args2)>::type{} @@ -289,23 +289,23 @@ private: template <class ..._Args, size_t ..._Idx> _LIBCPP_INLINE_VISIBILITY - tuple<allocator_arg_t const&, memory_resource*, _Args&&...> + tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...> __transform_tuple(integral_constant<int, 1>, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) const + __tuple_indices<_Idx...>) { - using _Tup = tuple<allocator_arg_t const&, memory_resource*, _Args&&...>; - return _Tup(allocator_arg, resource(), + using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>; + return _Tup(allocator_arg, *this, _VSTD::get<_Idx>(_VSTD::move(__t))...); } template <class ..._Args, size_t ..._Idx> _LIBCPP_INLINE_VISIBILITY - tuple<_Args&&..., memory_resource*> + tuple<_Args&&..., polymorphic_allocator&> __transform_tuple(integral_constant<int, 2>, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) const + __tuple_indices<_Idx...>) { - using _Tup = tuple<_Args&&..., memory_resource*>; - return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource()); + using _Tup = tuple<_Args&&..., polymorphic_allocator&>; + return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., *this); } _LIBCPP_INLINE_VISIBILITY |