This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
std::expected<cv void, E>
should not be conditionally deletedSection: 22.8.7.4 [expected.void.assign] Status: WP Submitter: Jiang An Opened: 2023-12-16 Last modified: 2024-04-02
Priority: Not Prioritized
View all other issues in [expected.void.assign].
View all issues with WP status.
Discussion:
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.
[2024-03-11; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[Tokyo 2024-03-23; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4971.
Modify 22.8.7.4 [expected.void.assign] as indicated:
constexpr expected& operator=(expected&& rhs) noexcept(see below);-?- Constraints:
[…] -6- Remarks: The exception specification is equivalent tois_move_constructible_v<E>
istrue
andis_move_assignable_v<E>
istrue
.is_nothrow_move_constructible_v<E> && is_nothrow_move_assignable_v<E>
.-7- This operator is defined as deleted unlessis_move_constructible_v<E>
istrue
andis_move_assignable_v<E>
istrue
.