Title
expected<cv void, E> move constructor should move
Status
c++23
Section
[expected.void.assign]
Submitter
Jonathan Wakely

Created on 2022-03-23.00:00:00 last changed 12 months ago

Messages

Date: 2022-07-25.20:32:58

Proposed resolution:

This wording is relative to N4910.

  1. Modify [expected.void.assign] as indicated:

    constexpr expected& operator=(expected&& rhs) noexcept(see below);
    

    -4- Effects:

    1. (4.1) — If this->has_value() && rhs.has_value() is true, no effects.

    2. (4.2) — Otherwise, if this->has_value() is true, equivalent to:

      construct_at(addressof(unex), std::move(rhs.unex));
      has_val = false;
      
    3. (4.3) — Otherwise, if rhs.has_value() is true, destroys unex and sets has_val to true.

    4. (4.4) — Otherwise, equivalent to unex = std::move(rhs.error()).

Date: 2022-07-25.00:00:00

[ 2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP. ]

Date: 2022-07-15.00:00:00

[ 2022-07-15; LWG telecon: move to Ready ]

Date: 2022-05-15.00:00:00

[ 2022-05-17; Reflector poll ]

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

Date: 2022-03-23.00:00:00

For expected<cv void>::operator=(expected&&) we have this in the last bullet of the Effects element:

Otherwise, equivalent to unex = rhs.error().

That should be a move assignment, not a copy assignment.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-07-25 20:32:58adminsetmessages: + msg12641
2022-07-25 20:32:58adminsetstatus: ready -> wp
2022-07-25 20:28:19adminsetmessages: + msg12615
2022-05-17 11:57:24adminsetmessages: + msg12453
2022-05-17 11:57:24adminsetstatus: new -> ready
2022-03-26 13:33:21adminsetmessages: + msg12415
2022-03-23 00:00:00admincreate