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.
get-state functions are incorrectSection: 33.9.12.7 [exec.schedule.from] Status: WP Submitter: Eric Niebler Opened: 2025-02-03 Last modified: 2025-06-23
Priority: 1
View all other issues in [exec.schedule.from].
View all issues with WP status.
Discussion:
Imported from: cplusplus/sender-receiver #313 and cplusplus/sender-receiver #314.
33.9.12.7 [exec.schedule.from] p6 reads:
The memberThe constraint should account for the fact that the child sender will be connected withimpls-for<schedule_from_t>::get-stateis initialized with a callable object equivalent to the following lambda:[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(see below) requires sender_in<child-type<Sndr>, env_of_t<Rcvr>> {
FWD-ENV(get_env(rcvr)).
[ The resolution touches some of the same text as LWG 4198(i), but without conflicting. ]
Imported from: cplusplus/sender-receiver #315.
33.9.12.12 [exec.when.all] p6 reads:
The memberThe problem is in (6.3). It should be forwarding onimpls-for<when_all_t>::get-envis initialized with a callable object equivalent to the following lambda expression:Returns an object[]<class State, class Rcvr>(auto&&, State& state, const Receiver& rcvr) noexcept { return see below; }esuch that
- (6.1) —
decltype(e)modelsqueryable, and- (6.2) —
e.query(get_stop_token)is expression-equivalent tostate.stop-src.get_token(), and- (6.3) — given a query object
qwith type other than cvstop_token_t,e.query(q)is expression-equivalent toget_env(rcvr).query(q).
forwarding-query's
to get_env(rcvr) but is is instead forwarding all queries.
Imported from: cplusplus/sender-receiver #316.
The child senders should only see the parent's queries if they are forwarding queries.
Imported from: cplusplus/sender-receiver #311.
33.9.12.14 [exec.stopped.opt]/para 3 reads:
Letthe test forsndrandenvbe subexpressions such thatSndrisdecltype((sndr))andEnvisdecltype((env)). Ifsender-for<Sndr, stopped_as_optional_t>isfalse, or if the typesingle-sender-value-type<Sndr, Env>is ill-formed orvoid, then the expressionstopped_as_optional.transform_sender(sndr, env)is ill-formed; otherwise, it is equivalent to:
single-sender-value-type<Sndr, Env> is incorrect.
It should be testing its child for single-sender-ness.
In addition, it should be applying FWD-ENV-T to Env
so that only forwarding queries are forwarded.
[2025-02-07; Reflector poll]
Set priority to 1 after reflector poll.
[Hagenberg 2025-02-11; move to Ready]
[Sofia 2025-06-21; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N5001.
-2- For a queryable objectenv,FWD-ENV(env)is an expression whose type satisfiesqueryablesuch that for a query objectqand a pack of subexpressionsas, the expressionFWD-ENV(env).query(q, as...)is ill-formed ifforwarding_query(q)isfalse; otherwise, it is expression-equivalent toenv.query(q, as...). The typeFWD-ENV-T(Env)isdecltype(FWD-ENV(declval<Env>())).
-6- The memberimpls-for<schedule_from_t>::get-stateis initialized with a callable object equivalent to the following lambda:[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(see below) requires sender_in<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)> {…
-8- Let
Sigsbe a pack of the arguments to thecompletion_signaturesspecialization named bycompletion_signatures_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>. Letas-tuplebe an alias template that transforms a completion signatureTag(Args...)into the tuple specializationdecayed-tuple<Tag, Args...>. Thenvariant_tdenotes the typevariant<monostate, as-tuple<Sigs>...>, except with duplicate types removed.
-6- Let
receiver2denote the following exposition-only class template:Invocation of the functionnamespace std::execution { … }receiver2::get_envreturns an objectesuch that
- (6.1) —
decltype(e)modelsqueryableand- (6.2) — given a query object
q, the expressione.query(q)is expression-equivalent toenv.query(q)if that expression is valid,; otherwise, if the type ofqsatisfiesforwarding-query,e.query(q)is expression-equivalent toget_env(rcvr).query(q); otherwise,e.query(q)is ill-formed.-7-
impls-for<decayed-typeof<let-cpo>>::get-stateis initialized with a callable object […]-8- Let
Sigsbe a pack of the arguments to thecompletion_signaturesspecialization named bycompletion_signatures_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>. LetLetSigsbe a pack of those types inSigswith a return type ofdecayed-typeof<set-cpo>. Letas-tuplebe an alias template such thatas-tuple<Tag(Args...)>denotes the typedecayed-tuple<Args...>. Thenargs_variant_tdenotes the typevariant<monostate, as-tuple<LetSigs>...>except with duplicate types removed.
-6- The member
impls-for<when_all_t>::get-envis initialized with a callable object equivalent to the following lambda expression:Returns an object[]<class State, class Rcvr>(auto&&, State& state, const Receiver& rcvr) noexcept { return see below; }esuch that
- (6.1) —
decltype(e)modelsqueryable, and- (6.2) —
e.query(get_stop_token)is expression-equivalent tostate.stop-src.get_token(), and- (6.3) — given a query object
qwith type other than cvstop_token_tand whose type satisfiesforwarding-query,e.query(q)is expression-equivalent toget_env(rcvr).query(q).-7- The member
impls-for<when_all_t>::get-stateis initialized with a callable object equivalent to the following lambda expression:where e is the expression[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(e) -> decltype(e) { return e; }andstd::forward<Sndr>(sndr).apply(make-state<Rcvr>())make-stateis the following exposition-only class template:…template<class Sndr, class Env> concept max-1-sender-in = sender_in<Sndr, Env> && // exposition only (tuple_size_v<value_types_of_t<Sndr, Env, tuple, tuple>> <= 1); enum class disposition { started, error, stopped }; // exposition only template<class Rcvr> struct make-state { template<max-1-sender-in<FWD-ENV-T(env_of_t<Rcvr>)>... Sndrs>-8- Let
copy_failbeexception_ptrif […]-9- The alias
values_tupledenotes the typeif that type is well-formed; otherwise,tuple<value_types_of_t<Sndrs, FWD-ENV-T(env_of_t<Rcvr>), decayed-tuple, optional>...>tuple<>.
-5- The memberimpls-for<into_variant_t>::get-stateis initialized with a callable object equivalent to the following lambda:[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept -> type_identity<value_types_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>> { return {}; }
-3- Letsndrandenvbe subexpressions such thatSndrisdecltype((sndr))andEnvisdecltype((env)). Ifsender-for<Sndr, stopped_as_optional_t>isfalse, or if the typesingle-sender-value-type<child-type<Sndr>, FWD-ENV-T(Env)>is ill-formed orvoid, then the expressionstopped_as_optional.transform_sender(sndr, env)is ill-formed; otherwise, it is equivalent to:…auto&& [_, _, child] = sndr; using V = single-sender-value-type<child-type<Sndr>, FWD-ENV-T(Env)>;