get-state
functions are incorrectSection: 33.9.12.5 [exec.schedule.from] Status: Ready Submitter: Eric Niebler Opened: 2025-02-03 Last modified: 2025-02-11
Priority: 1
View other active issues in [exec.schedule.from].
View all other issues in [exec.schedule.from].
View all issues with Ready status.
Discussion:
Imported from: cplusplus/sender-receiver #313 and cplusplus/sender-receiver #314.
33.9.12.5 [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-state
is 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, but without conflicting. ]
Imported from: cplusplus/sender-receiver #315.
33.9.12.11 [exec.when.all] p6 reads:
The memberThe problem is in (6.3). It should be forwarding onimpls-for<when_all_t>::get-env
is 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; }
e
such 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
q
with 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.13 [exec.stopped.opt]/para 3 reads:
Letthe test forsndr
andenv
be subexpressions such thatSndr
isdecltype((sndr))
andEnv
isdecltype((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-10; move to Ready]
Proposed resolution:
This wording is relative to N5001.
-2- For a queryable objectenv
,FWD-ENV(env)
is an expression whose type satisfiesqueryable
such that for a query objectq
and 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-state
is 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
Sigs
be a pack of the arguments to thecompletion_signatures
specialization named bycompletion_signatures_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>
. Letas-tuple
be an alias template that transforms a completion signatureTag(Args...)
into the tuple specializationdecayed-tuple<Tag, Args...>
. Thenvariant_t
denotes the typevariant<monostate, as-tuple<Sigs>...>
, except with duplicate types removed.
-6- Let
receiver2
denote the following exposition-only class template:Invocation of the functionnamespace std::execution { … }
receiver2::get_env
returns an objecte
such that
- (6.1) —
decltype(e)
modelsqueryable
and- (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 ofq
satisfiesforwarding-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-state
is initialized with a callable object […]-8- Let
Sigs
be a pack of the arguments to thecompletion_signatures
specialization named bycompletion_signatures_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>
. LetLetSigs
be a pack of those types inSigs
with a return type ofdecayed-typeof<set-cpo>
. Letas-tuple
be an alias template such thatas-tuple<Tag(Args...)>
denotes the typedecayed-tuple<Args...>
. Thenargs_variant_t
denotes the typevariant<monostate, as-tuple<LetSigs>...>
except with duplicate types removed.
-6- The member
impls-for<when_all_t>::get-env
is 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; }
e
such 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
q
with type other than cvstop_token_t
and whose type satisfiesforwarding-query
,e.query(q)
is expression-equivalent toget_env(rcvr).query(q)
.-7- The member
impls-for<when_all_t>::get-state
is 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-state
is 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_fail
beexception_ptr
if […]-9- The alias
values_tuple
denotes 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-state
is 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- Letsndr
andenv
be subexpressions such thatSndr
isdecltype((sndr))
andEnv
isdecltype((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)>;