Title
Move assignment operator of std::expected<cv void, E> should not be conditionally deleted
Status
wp
Section
[expected.void.assign]
Submitter
Jiang An

Created on 2023-12-16.00:00:00 last changed 8 months ago

Messages

Date: 2024-04-02.10:29:12

Proposed resolution:

This wording is relative to N4971.

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

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

    -?- Constraints: is_move_constructible_v<E> is true and is_move_assignable_v<E> is true.

    […]

    -6- Remarks: The exception specification is equivalent to is_nothrow_move_constructible_v<E> && is_nothrow_move_assignable_v<E>.

    -7- This operator is defined as deleted unless is_move_constructible_v<E> is true and is_move_assignable_v<E> is true.

Date: 2024-04-02.10:29:12

[ Tokyo 2024-03-23; Status changed: Voting → WP. ]

Date: 2024-03-15.00:00:00

[ 2024-03-11; Reflector poll ]

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

Date: 2023-12-16.00:00:00

It seems intended that copy functions of std::optional, std::variant, and std::expected are conditionally deleted, while move functions are constrained. However, the move assignment operator of std::expected<cv void, E> is currently conditionally deleted, which is inconsistent.

History
Date User Action Args
2024-04-02 10:29:12adminsetmessages: + msg14040
2024-04-02 10:29:12adminsetstatus: voting -> wp
2024-03-18 09:32:04adminsetstatus: ready -> voting
2024-03-11 21:55:38adminsetmessages: + msg13979
2024-03-11 21:55:38adminsetstatus: new -> ready
2023-12-22 10:28:38adminsetmessages: + msg13892
2023-12-16 00:00:00admincreate