diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 8b5111a7f82..9447bf7ff06 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -2140,10 +2140,10 @@ template && _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(_STD get<0>(_STD move(_Pair)), _STD forward_as_tuple(_STD get<1>(_STD move(_Pair))); return _STD make_tuple(piecewise_construct, - _STD uses_allocator_construction_args(_Al, _STD move(_Pair).first), - _STD uses_allocator_construction_args(_Al, _STD move(_Pair).second)); + _STD uses_allocator_construction_args(_Al, _STD get<0>(_STD move(_Pair))), + _STD uses_allocator_construction_args(_Al, _STD get<1>(_STD move(_Pair)))); } template diff --git a/tests/std/tests/P0475R1_P0591R4_uses_allocator_construction/test.cpp b/tests/std/tests/P0475R1_P0591R4_uses_allocator_construction/test.cpp index 71d51033598..291eae8ae37 100644 --- a/tests/std/tests/P0475R1_P0591R4_uses_allocator_construction/test.cpp +++ b/tests/std/tests/P0475R1_P0591R4_uses_allocator_construction/test.cpp @@ -179,6 +179,18 @@ void test_GH_2021() { // COMPILE-ONLY tags[0]; } +struct MoveOnlyType { + MoveOnlyType() = default; + MoveOnlyType(MoveOnlyType&&) = default; +}; + +void test_LWG3527() { // COMPILE-ONLY + allocator alloc; + MoveOnlyType obj; + pair p{move(obj), move(obj)}; + [[maybe_unused]] auto t = uses_allocator_construction_args>(alloc, move(p)); +} + int main() { test_P0475R1();