Title
Missing requirements for expected<T, E> requires is_void<T>
Status
wp
Section
[expected.void.general]
Submitter
Casey Carter

Created on 2022-05-24.00:00:00 last changed 4 months ago

Messages

Date: 2022-07-25.20:32:58

Proposed resolution:

This wording is relative to N4910.

[Drafting note: There is some drive-by cleanup that I couldn't resist while touching this wording: (1) strike the redundant "suitably aligned" guarantee, (2) Don't repeat in prose that the exposition-only members are exposition-only.]

  1. Modify [expected.object.general] as indicated:

    -1- Any object of type expected<T, E> either contains a value of type T or a value of type E within its own storage. Implementations are not permitted to use additional storage, such as dynamic memory, to allocate the object of type T or the object of type E. These objects are allocated in a region of the expected<T, E> storage suitably aligned for the types T and E. Members has_val, val, and unex are provided for exposition only. Member has_val indicates whether the expected<T, E> object contains an object of type T.

  2. Modify [expected.void.general] as indicated:

    -?- Any object of type expected<T, E> either represents a value of type T, or contains a value of type E within its own storage. Implementations are not permitted to use additional storage, such as dynamic memory, to allocate the object of type E. Member has_val indicates whether the expected<T, E> object represents a value of type T.

    -?- A program that instantiates the definition of the template expected<T, E> with a type for the E parameter that is not a valid template argument for unexpected is ill-formed.

    -1- E shall meet the requirements of Cpp17Destructible (Table [tab:cpp17.destructible]).

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-06-15.00:00:00

[ 2022-06-21; Reflector poll ]

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

Date: 2022-06-15.00:00:00

[ 2022-06-21; Reflector poll ]

Set priority to 2 after reflector poll.

Date: 2022-06-15.00:00:00

[ 2022-06-21; Jonathan adds "Member" before "has_val" ]

Date: 2022-05-24.00:00:00

The partial specialization expected<T, E> requires is_void<T> specified in [expected.void.general] is missing some template parameter requirements that should have been copied from [expected.object.general]. We should copy the pertinent requirements from the first two paragraphs of the latter subclause into new paragraphs in the first subclause (the pertinent requirement from the third paragraph is already present in [expected.void.general]).

History
Date User Action Args
2022-07-25 20:32:58adminsetmessages: + msg12645
2022-07-25 20:32:58adminsetstatus: ready -> wp
2022-07-25 20:28:19adminsetmessages: + msg12619
2022-06-21 12:17:09adminsetmessages: + msg12527
2022-06-21 12:17:09adminsetstatus: new -> ready
2022-06-21 11:46:11adminsetmessages: + msg12512
2022-06-21 11:32:17adminsetmessages: + msg12510
2022-05-29 08:33:28adminsetmessages: + msg12478
2022-05-24 00:00:00admincreate