Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement LWG-3527 #2194

Merged
merged 4 commits into from Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions stl/inc/xmemory
Expand Up @@ -2140,10 +2140,10 @@ template <class _Ty, class _Alloc, class _Uty1, class _Uty2, enable_if_t<_Is_spe
_NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, pair<_Uty1, _Uty2>&& _Pair) noexcept {
// equivalent to
// return _STD uses_allocator_construction_args<_Ty>(_Al, piecewise_construct,
// _STD forward_as_tuple(_STD move(_Pair).first), _STD forward_as_tuple(_STD move(_Pair).second));
// _STD forward_as_tuple(get<0>(_STD move(_Pair)), _STD forward_as_tuple(get<1>(_STD move(_Pair)));
return _STD make_tuple(piecewise_construct,
_STD uses_allocator_construction_args<typename _Ty::first_type>(_Al, _STD move(_Pair).first),
_STD uses_allocator_construction_args<typename _Ty::second_type>(_Al, _STD move(_Pair).second));
_STD uses_allocator_construction_args<typename _Ty::first_type>(_Al, get<0>(_STD move(_Pair))),
_STD uses_allocator_construction_args<typename _Ty::second_type>(_Al, get<1>(_STD move(_Pair))));
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
}

template <class _Ty, class _Alloc, class... _Types>
Expand Down
Expand Up @@ -179,6 +179,17 @@ void test_GH_2021() { // COMPILE-ONLY
tags[0];
}

struct MoveOnlyType {
MoveOnlyType() = default;
MoveOnlyType(MoveOnlyType&&) = default;
};

void test_LWG3527() { // COMPILE-ONLY
std::allocator<MoveOnlyType> alloc;
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
auto p = pair<MoveOnlyType&&, MoveOnlyType&&>{MoveOnlyType{}, MoveOnlyType{}};
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
[[maybe_unused]] auto t = uses_allocator_construction_args<pair<MoveOnlyType&&, MoveOnlyType&&>>(alloc, move(p));
}

int main() {
test_P0475R1();

Expand Down