Skip to content

Commit cfef8fb

Browse files
[libc++] LWG3187: P0591R4 reverted DR 2586 fixes to ...
... `scoped_allocator_adaptor::construct()` Applying it (adding missing `const``) to pre-C++20 dispatching mechanisms. Also - make dispatch mechanisms in pre-C++20 `construct` more consistent, and - add fallback dispatching and overloads to emit better error messages.
1 parent d9f9064 commit cfef8fb

File tree

14 files changed

+143
-264
lines changed

14 files changed

+143
-264
lines changed

libcxx/docs/Status/Cxx20Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"`LWG3184 <https://wg21.link/LWG3184>`__","Inconsistencies in ``bind_front``\ wording","2019-07 (Cologne)","|Complete|","13",""
152152
"`LWG3185 <https://wg21.link/LWG3185>`__","Uses-allocator construction functions missing ``constexpr``\ and ``noexcept``\ ","2019-07 (Cologne)","|Complete|","16",""
153153
"`LWG3186 <https://wg21.link/LWG3186>`__","``ranges``\ removal, partition, and ``partial_sort_copy``\ algorithms discard useful information","2019-07 (Cologne)","|Complete|","15",""
154-
"`LWG3187 <https://wg21.link/LWG3187>`__","`P0591R4 <https://wg21.link/p0591r4>`__ reverted DR 2586 fixes to ``scoped_allocator_adaptor::construct()``\ ","2019-07 (Cologne)","","",""
154+
"`LWG3187 <https://wg21.link/LWG3187>`__","`P0591R4 <https://wg21.link/p0591r4>`__ reverted DR 2586 fixes to ``scoped_allocator_adaptor::construct()``\ ","2019-07 (Cologne)","|Complete|","22",""
155155
"`LWG3191 <https://wg21.link/LWG3191>`__","``std::ranges::shuffle``\ synopsis does not match algorithm definition","2019-07 (Cologne)","|Complete|","15",""
156156
"`LWG3196 <https://wg21.link/LWG3196>`__","``std::optional<T>``\ is ill-formed is ``T``\ is an array","2019-07 (Cologne)","|Complete|","",""
157157
"`LWG3198 <https://wg21.link/LWG3198>`__","Bad constraint on ``std::span::span()``\ ","2019-07 (Cologne)","|Complete|","",""

libcxx/include/__memory/allocator_arg_t.h

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <__memory/uses_allocator.h>
1515
#include <__type_traits/integral_constant.h>
1616
#include <__type_traits/is_constructible.h>
17+
#include <__type_traits/remove_cv.h>
1718
#include <__type_traits/remove_cvref.h>
1819
#include <__utility/forward.h>
1920

@@ -40,34 +41,15 @@ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
4041
template <class _Tp, class _Alloc, class... _Args>
4142
struct __uses_alloc_ctor_imp {
4243
using _RawAlloc _LIBCPP_NODEBUG = __remove_cvref_t<_Alloc>;
43-
static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
44-
static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
45-
static const int value = __ua ? 2 - __ic : 0;
44+
static constexpr bool __ua = uses_allocator<__remove_cv_t<_Tp>, _RawAlloc>::value;
45+
static constexpr bool __ic_head = is_constructible<_Tp, allocator_arg_t, const _RawAlloc&, _Args...>::value;
46+
static constexpr bool __ic_tail = is_constructible<_Tp, _Args..., const _RawAlloc&>::value;
47+
static constexpr int value = __ua ? (__ic_head ? 1 : __ic_tail ? 2 : -1) : 0;
4648
};
4749

4850
template <class _Tp, class _Alloc, class... _Args>
4951
struct __uses_alloc_ctor : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value> {};
5052

51-
template <class _Tp, class _Allocator, class... _Args>
52-
inline _LIBCPP_HIDE_FROM_ABI void
53-
__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
54-
new (__storage) _Tp(std::forward<_Args>(__args)...);
55-
}
56-
57-
// FIXME: This should have a version which takes a non-const alloc.
58-
template <class _Tp, class _Allocator, class... _Args>
59-
inline _LIBCPP_HIDE_FROM_ABI void
60-
__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
61-
new (__storage) _Tp(allocator_arg, __a, std::forward<_Args>(__args)...);
62-
}
63-
64-
// FIXME: This should have a version which takes a non-const alloc.
65-
template <class _Tp, class _Allocator, class... _Args>
66-
inline _LIBCPP_HIDE_FROM_ABI void
67-
__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
68-
new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
69-
}
70-
7153
#endif // _LIBCPP_CXX03_LANG
7254

7355
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__memory/uses_allocator_construction.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <__type_traits/enable_if.h>
1717
#include <__type_traits/remove_cv.h>
1818
#include <__utility/declval.h>
19+
#include <__utility/integer_sequence.h>
1920
#include <__utility/pair.h>
2021
#include <__utility/piecewise_construct.h>
2122
#include <tuple>
@@ -29,6 +30,43 @@ _LIBCPP_PUSH_MACROS
2930

3031
_LIBCPP_BEGIN_NAMESPACE_STD
3132

33+
// TODO: Guard this furtherly with _LIBCPP_STD_VER < 20 once P0591R4 is fully implemented.
34+
#if !defined(_LIBCPP_CXX03_LANG)
35+
36+
template <class _Alloc, class... _Args, size_t... _Is>
37+
_LIBCPP_HIDE_FROM_ABI void __transform_tuple_using_allocator_impl(
38+
integral_constant<int, -1>, const _Alloc&, tuple<_Args...>&&, __index_sequence<_Is...>) {
39+
static_assert(false, "If uses_allocator_v<T, A> is true, T has to be allocator-constructible");
40+
}
41+
42+
template <class _Alloc, class... _Args, size_t... _Is>
43+
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&...> __transform_tuple_using_allocator_impl(
44+
integral_constant<int, 0>, const _Alloc&, tuple<_Args...>&& __t, __index_sequence<_Is...>) {
45+
return tuple<_Args&&...>(std::move(__t));
46+
}
47+
48+
template <class _Alloc, class... _Args, size_t... _Is>
49+
_LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, const _Alloc&, _Args&&...> __transform_tuple_using_allocator_impl(
50+
integral_constant<int, 1>, const _Alloc& __a, tuple<_Args...>&& __t, __index_sequence<_Is...>) {
51+
return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __a, std::get<_Is>(std::move(__t))...);
52+
}
53+
54+
template <class _Alloc, class... _Args, size_t... _Is>
55+
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., const _Alloc&> __transform_tuple_using_allocator_impl(
56+
integral_constant<int, 2>, const _Alloc& __a, tuple<_Args...>&& __t, __index_sequence<_Is...>) {
57+
return tuple<_Args&&..., const _Alloc&>(std::get<_Is>(std::move(__t))..., __a);
58+
}
59+
60+
template <class _Tp, class _Alloc, class... _Args>
61+
_LIBCPP_HIDE_FROM_ABI auto __transform_tuple_using_allocator(const _Alloc& __a, tuple<_Args...>&& __t)
62+
-> decltype(std::__transform_tuple_using_allocator_impl(
63+
__uses_alloc_ctor<_Tp, _Alloc, _Args...>{}, __a, std::move(__t), __make_index_sequence<sizeof...(_Args)>{})) {
64+
return std::__transform_tuple_using_allocator_impl(
65+
__uses_alloc_ctor<_Tp, _Alloc, _Args...>{}, __a, std::move(__t), __make_index_sequence<sizeof...(_Args)>{});
66+
}
67+
68+
#endif // !defined(_LIBCPP_CXX03_LANG)
69+
3270
#if _LIBCPP_STD_VER >= 17
3371

3472
template <class _Tp>

libcxx/include/__memory_resource/polymorphic_allocator.h

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@
1414
#include <__cstddef/byte.h>
1515
#include <__cstddef/max_align_t.h>
1616
#include <__fwd/pair.h>
17+
#include <__memory/allocator_arg_t.h>
18+
#include <__memory/uses_allocator.h>
19+
#include <__memory/uses_allocator_construction.h>
1720
#include <__memory_resource/memory_resource.h>
1821
#include <__new/exceptions.h>
1922
#include <__new/placement_new_delete.h>
23+
#include <__type_traits/is_constructible.h>
24+
#include <__type_traits/remove_cv.h>
25+
#include <__utility/as_const.h>
2026
#include <__utility/exception_guard.h>
2127
#include <__utility/piecewise_construct.h>
2228
#include <limits>
@@ -122,24 +128,27 @@ class _LIBCPP_AVAILABILITY_PMR polymorphic_allocator {
122128

123129
template <class _Tp, class... _Ts>
124130
_LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Ts&&... __args) {
125-
std::__user_alloc_construct_impl(
126-
typename __uses_alloc_ctor<_Tp, polymorphic_allocator&, _Ts...>::type(),
127-
__p,
128-
*this,
129-
std::forward<_Ts>(__args)...);
131+
if constexpr (!uses_allocator_v<remove_cv_t<_Tp>, polymorphic_allocator>) {
132+
static_assert(is_constructible_v<_Tp, _Ts...>,
133+
"If uses_allocator_v<T, polymorphic_allocator> is false, T has to be constructible from arguments");
134+
::new ((void*)__p) _Tp(std::forward<_Ts>(__args)...);
135+
} else if constexpr (is_constructible_v<_Tp, allocator_arg_t, const polymorphic_allocator&, _Ts...>) {
136+
::new ((void*)__p) _Tp(allocator_arg, std::as_const(*this), std::forward<_Ts>(__args)...);
137+
} else if constexpr (is_constructible_v<_Tp, _Ts..., const polymorphic_allocator&>) {
138+
::new ((void*)__p) _Tp(std::forward<_Ts>(__args)..., std::as_const(*this));
139+
} else {
140+
static_assert(
141+
false, "If uses_allocator_v<T, polymorphic_allocator> is true, T has to be allocator-constructible");
142+
}
130143
}
131144

132145
template <class _T1, class _T2, class... _Args1, class... _Args2>
133146
_LIBCPP_HIDE_FROM_ABI void
134147
construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
135148
::new ((void*)__p) pair<_T1, _T2>(
136149
piecewise_construct,
137-
__transform_tuple(typename __uses_alloc_ctor< _T1, polymorphic_allocator&, _Args1... >::type(),
138-
std::move(__x),
139-
make_index_sequence<sizeof...(_Args1)>()),
140-
__transform_tuple(typename __uses_alloc_ctor< _T2, polymorphic_allocator&, _Args2... >::type(),
141-
std::move(__y),
142-
make_index_sequence<sizeof...(_Args2)>()));
150+
std::__transform_tuple_using_allocator<_T1>(*this, std::move(__x)),
151+
std::__transform_tuple_using_allocator<_T2>(*this, std::move(__y)));
143152
}
144153

145154
template <class _T1, class _T2>
@@ -193,26 +202,6 @@ class _LIBCPP_AVAILABILITY_PMR polymorphic_allocator {
193202
# endif
194203

195204
private:
196-
template <class... _Args, size_t... _Is>
197-
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
198-
__transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
199-
return std::forward_as_tuple(std::get<_Is>(std::move(__t))...);
200-
}
201-
202-
template <class... _Args, size_t... _Is>
203-
_LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>
204-
__transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
205-
using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>;
206-
return _Tup(allocator_arg, *this, std::get<_Is>(std::move(__t))...);
207-
}
208-
209-
template <class... _Args, size_t... _Is>
210-
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., polymorphic_allocator&>
211-
__transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
212-
using _Tup = tuple<_Args&&..., polymorphic_allocator&>;
213-
return _Tup(std::get<_Is>(std::move(__t))..., *this);
214-
}
215-
216205
_LIBCPP_HIDE_FROM_ABI size_t __max_size() const noexcept {
217206
return numeric_limits<size_t>::max() / sizeof(value_type);
218207
}

libcxx/include/scoped_allocator

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,15 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
113113
# include <__cxx03/__config>
114114
#else
115115
# include <__config>
116+
# include <__memory/allocator_arg_t.h>
116117
# include <__memory/allocator_traits.h>
118+
# include <__memory/uses_allocator.h>
117119
# include <__memory/uses_allocator_construction.h>
118120
# include <__type_traits/common_type.h>
119121
# include <__type_traits/enable_if.h>
120122
# include <__type_traits/integral_constant.h>
121123
# include <__type_traits/is_constructible.h>
124+
# include <__type_traits/remove_cv.h>
122125
# include <__type_traits/remove_reference.h>
123126
# include <__utility/declval.h>
124127
# include <__utility/forward.h>
@@ -421,23 +424,32 @@ public:
421424
# else
422425
template <class _Tp, class... _Args>
423426
_LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Args&&... __args) {
424-
__construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(), __p, std::forward<_Args>(__args)...);
427+
using _OM = __outermost<outer_allocator_type>;
428+
if constexpr (!uses_allocator<__remove_cv_t<_Tp>, inner_allocator_type>::value) {
429+
allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
430+
} else if constexpr (is_constructible<_Tp, allocator_arg_t, const inner_allocator_type&, _Args...>::value) {
431+
const auto& __inner_alloc = inner_allocator();
432+
allocator_traits<typename _OM::type>::construct(
433+
_OM()(outer_allocator()), __p, allocator_arg, __inner_alloc, std::forward<_Args>(__args)...);
434+
} else if constexpr (is_constructible<_Tp, _Args..., const inner_allocator_type&>::value) {
435+
const auto& __inner_alloc = inner_allocator();
436+
allocator_traits<typename _OM::type>::construct(
437+
_OM()(outer_allocator()), __p, std::forward<_Args>(__args)..., __inner_alloc);
438+
} else {
439+
static_assert(false, "If uses_allocator_v<T, inner_allocator_type> is true, T has to be allocator-constructible");
440+
}
425441
}
426442

427443
template <class _T1, class _T2, class... _Args1, class... _Args2>
428444
_LIBCPP_HIDE_FROM_ABI void
429445
construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
430-
typedef __outermost<outer_allocator_type> _OM;
446+
using _OM = __outermost<outer_allocator_type>;
431447
allocator_traits<typename _OM::type>::construct(
432448
_OM()(outer_allocator()),
433449
__p,
434450
piecewise_construct,
435-
__transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
436-
std::move(__x),
437-
__make_index_sequence<sizeof...(_Args1)>()),
438-
__transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
439-
std::move(__y),
440-
__make_index_sequence<sizeof...(_Args2)>()));
451+
std::__transform_tuple_using_allocator<_T1>(inner_allocator(), std::move(__x)),
452+
std::__transform_tuple_using_allocator<_T2>(inner_allocator(), std::move(__y)));
441453
}
442454

443455
template <class _T1, class _T2>
@@ -481,46 +493,6 @@ private:
481493
_LIBCPP_HIDE_FROM_ABI explicit scoped_allocator_adaptor(
482494
outer_allocator_type&& __o, inner_allocator_type&& __i) _NOEXCEPT : _Base(std::move(__o), std::move(__i)) {}
483495

484-
template <class _Tp, class... _Args>
485-
_LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 0>, _Tp* __p, _Args&&... __args) {
486-
typedef __outermost<outer_allocator_type> _OM;
487-
allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
488-
}
489-
490-
template <class _Tp, class... _Args>
491-
_LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 1>, _Tp* __p, _Args&&... __args) {
492-
typedef __outermost<outer_allocator_type> _OM;
493-
allocator_traits<typename _OM::type>::construct(
494-
_OM()(outer_allocator()), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...);
495-
}
496-
497-
template <class _Tp, class... _Args>
498-
_LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 2>, _Tp* __p, _Args&&... __args) {
499-
typedef __outermost<outer_allocator_type> _OM;
500-
allocator_traits<typename _OM::type>::construct(
501-
_OM()(outer_allocator()), __p, std::forward<_Args>(__args)..., inner_allocator());
502-
}
503-
504-
template <class... _Args, size_t... _Idx>
505-
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
506-
__transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
507-
return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
508-
}
509-
510-
template <class... _Args, size_t... _Idx>
511-
_LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
512-
__transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
513-
using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
514-
return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
515-
}
516-
517-
template <class... _Args, size_t... _Idx>
518-
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
519-
__transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
520-
using _Tup = tuple<_Args&&..., inner_allocator_type&>;
521-
return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
522-
}
523-
524496
template <class...>
525497
friend class __scoped_allocator_storage;
526498
};

libcxx/include/tuple

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ public:
382382
static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
383383
}
384384

385+
template <class _Alloc, class... _Args>
386+
_LIBCPP_HIDE_FROM_ABI __tuple_leaf(integral_constant<int, -1>, const _Alloc&, _Args&&...) {
387+
static_assert(false, "If uses_allocator_v<T, A> is true, T has to be allocator-constructible");
388+
}
389+
385390
template <class _Alloc>
386391
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) : __value_() {
387392
static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
@@ -456,6 +461,11 @@ public:
456461

457462
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) {}
458463

464+
template <class _Alloc, class... _Args>
465+
_LIBCPP_HIDE_FROM_ABI __tuple_leaf(integral_constant<int, -1>, const _Alloc&, _Args&&...) {
466+
static_assert(false, "If uses_allocator_v<T, A> is true, T has to be allocator-constructible");
467+
}
468+
459469
template <class _Alloc>
460470
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
461471

libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ void test_no_inner_alloc() {
4444
A.construct(ptr);
4545
assert(checkConstruct<>(ptr->first, UA_AllocArg, CA));
4646
assert(checkConstruct<>(ptr->second, UA_AllocLast, CA));
47-
#if TEST_STD_VER >= 20
48-
assert((P.checkConstruct<std::piecewise_construct_t&&,
47+
assert((P.checkConstruct<piecewise_construct_ref_t,
4948
std::tuple<std::allocator_arg_t, const SA&>&&,
5049
std::tuple<const SA&>&& >(CA, ptr)));
51-
#else
52-
assert((P.checkConstruct<std::piecewise_construct_t const&,
53-
std::tuple<std::allocator_arg_t, SA&>&&,
54-
std::tuple<SA&>&& >(CA, ptr)));
55-
#endif
5650
A.destroy(ptr);
5751
std::free(ptr);
5852
}
@@ -71,15 +65,8 @@ void test_no_inner_alloc() {
7165
A.construct(ptr);
7266
assert(checkConstruct<>(ptr->first, UA_AllocArg, CA));
7367
assert(checkConstruct<>(ptr->second, UA_None));
74-
#if TEST_STD_VER >= 20
75-
assert(
76-
(P.checkConstruct<std::piecewise_construct_t&&, std::tuple<std::allocator_arg_t, const SA&>&&, std::tuple<>&& >(
77-
CA, ptr)));
78-
#else
79-
assert(
80-
(P.checkConstruct<std::piecewise_construct_t const&, std::tuple<std::allocator_arg_t, SA&>&&, std::tuple<>&& >(
81-
CA, ptr)));
82-
#endif
68+
assert((P.checkConstruct<piecewise_construct_ref_t, std::tuple<std::allocator_arg_t, const SA&>&&, std::tuple<>&&>(
69+
CA, ptr)));
8370
A.destroy(ptr);
8471
std::free(ptr);
8572
}
@@ -108,15 +95,9 @@ void test_with_inner_alloc() {
10895
A.construct(ptr);
10996
assert(checkConstruct<>(ptr->first, UA_AllocArg, I));
11097
assert(checkConstruct<>(ptr->second, UA_AllocLast));
111-
#if TEST_STD_VER >= 20
112-
assert((POuter.checkConstruct<std::piecewise_construct_t&&,
98+
assert((POuter.checkConstruct<piecewise_construct_ref_t,
11399
std::tuple<std::allocator_arg_t, const SAInner&>&&,
114100
std::tuple<const SAInner&>&& >(O, ptr)));
115-
#else
116-
assert((POuter.checkConstruct<std::piecewise_construct_t const&,
117-
std::tuple<std::allocator_arg_t, SAInner&>&&,
118-
std::tuple<SAInner&>&& >(O, ptr)));
119-
#endif
120101
A.destroy(ptr);
121102
std::free(ptr);
122103
}
@@ -140,15 +121,9 @@ void test_with_inner_alloc() {
140121
A.construct(ptr);
141122
assert(checkConstruct<>(ptr->first, UA_AllocArg, I));
142123
assert(checkConstruct<>(ptr->second, UA_None));
143-
#if TEST_STD_VER >= 20
144-
assert((POuter.checkConstruct<std::piecewise_construct_t&&,
124+
assert((POuter.checkConstruct<piecewise_construct_ref_t,
145125
std::tuple<std::allocator_arg_t, const SAInner&>&&,
146126
std::tuple<>&& >(O, ptr)));
147-
#else
148-
assert((POuter.checkConstruct<std::piecewise_construct_t const&,
149-
std::tuple<std::allocator_arg_t, SAInner&>&&,
150-
std::tuple<>&& >(O, ptr)));
151-
#endif
152127
A.destroy(ptr);
153128
std::free(ptr);
154129
}

0 commit comments

Comments
 (0)