Title
uses_allocator_construction_args handles rvalue pairs of rvalue references incorrectly
Status
c++23
Section
[allocator.uses.construction]
Submitter
Tim Song

Created on 2021-02-27.00:00:00 last changed 5 months ago

Messages

Date: 2021-06-07.16:58:04

Proposed resolution:

This wording is relative to N4878.

  1. Edit [allocator.uses.construction] as indicated:

    template<class T, class Alloc, class U, class V>
      constexpr auto uses_allocator_construction_args(const Alloc& alloc,
                                                      pair<U, V>&& pr) noexcept -> see below;
    

    […]

    -15- Effects: Equivalent to:

    return uses_allocator_construction_args<T>(alloc, piecewise_construct,
                                                forward_as_tuple(std::move(pr).firstget<0>(std::move(pr))),
                                                forward_as_tuple(std::move(pr).secondget<1>(std::move(pr))));
    
Date: 2021-06-07.00:00:00

[ 2021-06-07 Approved at June 2021 virtual plenary. Status changed: Voting → WP. ]

Date: 2021-03-15.00:00:00

[ 2021-03-12; Reflector poll ]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Date: 2021-02-27.00:00:00

For an rvalue pair pr, uses_allocator_construction_args is specified to forward std::move(pr).first and std::move(pr).second. This is correct for non-references and lvalue references, but wrong for rvalue refrences because the class member access produces an lvalue (see [expr.ref]/6). get produces an xvalue, which is what is desired here.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2021-06-07 16:58:04adminsetmessages: + msg11897
2021-06-07 16:58:04adminsetstatus: voting -> wp
2021-05-26 21:11:22adminsetstatus: ready -> voting
2021-03-12 15:09:53adminsetmessages: + msg11736
2021-03-12 15:09:53adminsetstatus: new -> ready
2021-02-27 21:31:31adminsetmessages: + msg11717
2021-02-27 00:00:00admincreate