This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
promise
/future
/shared_future
consistentlySection: 32.10.6 [futures.promise] Status: C++23 Submitter: Tomasz Kamiński Opened: 2020-07-18 Last modified: 2023-11-22
Priority: 3
View other active issues in [futures.promise].
View all other issues in [futures.promise].
View all issues with C++23 status.
Discussion:
The resolution of the LWG 3458(i) clearly specified the requirement that
future
/shared_future
are ill-formed in situations when T
is native array
or function type. This requirement was not strictly necessary for future<T>
as it was already ill-formed due the signature of the get
function (that would be
ill-formed in such case), however it was still added for consistency of specification.
Similar, requirement should be introduced for the promise<T>
, for which
any call to get_future()
would be ill-formed, if T
is of array or function type.
promise<int[10]>
is ill-formed for libstdc++ and libc++, see
this code]
[2020-07-26; Reflector prioritization]
Set priority to 3 after reflector discussions. Tim Song made the suggestion to replace the P/R wording by the following alternative wording:
For the primary template,
R
shall be an object type that meets the Cpp17Destructible requirements.
Previous resolution [SUPERSEDED]:
This wording is relative to N4861.
Ideally the wording below would use a Mandates: element, but due to the still open issue LWG 3193(i) the wording below uses instead the more general "ill-formed" vocabulary.
Modify 32.10.6 [futures.promise] as indicated:
namespace std { template<class R> class promise { […] }; […] }-?- If
is_array_v<R>
istrue
oris_function_v<R>
istrue
, the program is ill-formed.
[2020-08-02; Daniel comments and provides alternative wording]
Following the suggestion of Tim Song a revised wording is provided which is intended to replace the currently agreed on wording for LWG 3458(i).
[2020-08-21; Issue processing telecon: Tentatively Ready]
Discussed a note clarifying that Cpp17Destructible disallows arrays (as well as types without accessible destructors). Can be added editorially.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
Proposed resolution:
This wording is relative to N4861.
Modify 32.10.6 [futures.promise] as indicated:
namespace std { template<class R> class promise { […] }; […] }-?- For the primary template,
-1- The implementation provides the templateR
shall be an object type that meets the Cpp17Destructible requirements.promise
and two specializations,promise<R&>
andpromise<void>
. These differ only in the argument type of the member functionsset_value
andset_value_at_thread_exit
, as set out in their descriptions, below.
Modify 32.10.7 [futures.unique.future] as indicated:
namespace std { template<class R> class future { […] }; }-?- For the primary template,
-4- The implementation provides the templateR
shall be an object type that meets the Cpp17Destructible requirements.future
and two specializations,future<R&>
andfuture<void>
. These differ only in the return type and return value of the member functionget
, as set out in its description, below.
Modify 32.10.8 [futures.shared.future] as indicated:
namespace std { template<class R> class shared_future { […] }; }-?- For the primary template,
-4- The implementation provides the templateR
shall be an object type that meets the Cpp17Destructible requirements.shared_future
and two specializations,shared_future<R&>
andshared_future<void>
. These differ only in the return type and return value of the member functionget
, as set out in its description, below.