Skip to content

Commit 676eb86

Browse files
burblebeetkoeppe
authored andcommitted
LWG4203 Constraints on get-state functions are incorrect
1 parent 4640282 commit 676eb86

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

source/exec.tex

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,8 @@
12791279
the expression \tcode{\exposid{FWD-ENV}(env).query(q, as...)} is ill-formed
12801280
if \tcode{forwarding_query(q)} is \tcode{false};
12811281
otherwise, it is expression-equivalent to \tcode{env.query(q, as...)}.
1282+
The type \tcode{\exposid{FWD-ENV-T}(Env)} is
1283+
\tcode{decltype(\exposid{FWD-ENV}(declval<Env>()))}.
12821284

12831285
\pnum
12841286
For a query object \tcode{q} and \tcode{a} subexpression \tcode{v},
@@ -3009,7 +3011,7 @@
30093011
is initialized with a callable object equivalent to the following lambda:
30103012
\begin{codeblock}
30113013
[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(@\seebelow@)
3012-
requires @\libconcept{sender_in}@<@\exposid{child-type}@<Sndr>, env_of_t<Rcvr>> {
3014+
requires @\libconcept{sender_in}@<@\exposid{child-type}@<Sndr>, @\exposid{FWD-ENV-T}@(env_of_t<Rcvr>)> {
30133015

30143016
auto& [_, sch, child] = sndr;
30153017

@@ -3039,7 +3041,7 @@
30393041
\pnum
30403042
Let \tcode{Sigs} be
30413043
a pack of the arguments to the \tcode{completion_signatures} specialization
3042-
named by \tcode{completion_signatures_of_t<\exposid{child-type}<Sndr>, env_of_t<Rcvr>>}.
3044+
named by \tcode{completion_signatures_of_t<\exposid{child-type}<Sndr>, \exposid{FWD-ENV-T}(env_of_t<Rcvr>)>}.
30433045
Let \exposid{as-tuple} be an alias template such that
30443046
\tcode{\exposid{as-tuple}<Tag(Args...)>} denotes
30453047
the type \tcode{\exposid{decayed-tuple}<Tag, Args...>}, and
@@ -3514,9 +3516,13 @@
35143516
\item
35153517
given a query object \tcode{q},
35163518
the expression \tcode{e.query(q)} is expression-equivalent
3517-
to \tcode{\exposid{env}.query(q)} if that expression is valid,
3518-
otherwise \tcode{e.query(q)} is expression-equivalent
3519-
to \tcode{get_env(\exposid{rcvr}).query(q)}.
3519+
to \tcode{\exposid{env}.query(q)} if that expression is valid;
3520+
otherwise,
3521+
if the type of \tcode{q} satisfies \exposconcept{forwarding-query},
3522+
\tcode{e.query(q)} is expression-equivalent
3523+
to \tcode{get_env(\exposid{rcvr}).query(q)};
3524+
otherwise,
3525+
\tcode{e.query(q)} is ill-formed.
35203526
\end{itemize}
35213527

35223528
\pnum
@@ -3543,7 +3549,7 @@
35433549
\pnum
35443550
Let \tcode{Sigs} be a pack of the arguments
35453551
to the \tcode{completion_signatures} specialization named by
3546-
\tcode{completion_signatures_of_t<\exposid{child-type}<Sndr>, env_of_t<Rcvr>>}.
3552+
\tcode{completion_signatures_of_t<\exposid{child-type}<Sndr>, \exposid{FWD-ENV-T}(env_of_t<Rcvr>)>}.
35473553
Let \tcode{LetSigs} be a pack of those types in \tcode{Sigs}
35483554
with a return type of \tcode{\exposid{decayed-typeof}<\exposid{set-cpo}>}.
35493555
Let \exposid{as-tuple} be an alias template
@@ -4174,7 +4180,8 @@
41744180
\tcode{e.query(get_stop_token)} is expression-equivalent to
41754181
\tcode{state.\exposid{stop-src}.get_token()}, and
41764182
\item
4177-
given a query object \tcode{q} with type other than \cv{} \tcode{stop_token_t},
4183+
given a query object \tcode{q} with type other than \cv{} \tcode{stop_token_t}
4184+
and whose type satisfies \exposconceptx{forwarding-que\-ry}{forwarding-query},
41784185
\tcode{e.query(q)} is expression-equivalent to \tcode{get_env(rcvr).query(q)}.
41794186
\end{itemize}
41804187

@@ -4201,7 +4208,7 @@
42014208

42024209
template<class Rcvr>
42034210
struct @\exposid{make-state}@ {
4204-
template<@\exposconcept{max-1-sender-in}@<env_of_t<Rcvr>>... Sndrs>
4211+
template<@\exposconcept{max-1-sender-in}@<@\exposid{FWD-ENV-T}@(env_of_t<Rcvr>)>... Sndrs>
42054212
auto operator()(auto, auto, Sndrs&&... sndrs) const {
42064213
using values_tuple = @\seebelow@;
42074214
using errors_variant = @\seebelow@;
@@ -4238,7 +4245,7 @@
42384245
\pnum
42394246
The alias \tcode{values_tuple} denotes the type
42404247
\begin{codeblock}
4241-
tuple<value_types_of_t<Sndrs, env_of_t<Rcvr>, @\exposid{decayed-tuple}@, optional>...>
4248+
tuple<value_types_of_t<Sndrs, @\exposid{FWD-ENV-T}@(env_of_t<Rcvr>), @\exposid{decayed-tuple}@, optional>...>
42424249
\end{codeblock}
42434250
if that type is well-formed; otherwise, \tcode{tuple<>}.
42444251

@@ -4426,7 +4433,7 @@
44264433
is initialized with a callable object equivalent to the following lambda:
44274434
\begin{codeblock}
44284435
[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept
4429-
-> type_identity<value_types_of_t<@\exposid{child-type}@<Sndr>, env_of_t<Rcvr>>> {
4436+
-> type_identity<value_types_of_t<@\exposid{child-type}@<Sndr>, @\exposid{FWD-ENV-T}@(env_of_t<Rcvr>)>> {
44304437
return {};
44314438
}
44324439
\end{codeblock}
@@ -4471,14 +4478,14 @@
44714478
\tcode{Env} is \tcode{decltype((env))}.
44724479
If \tcode{\exposconcept{sender-for}<Sndr, stopped_as_optional_t>}
44734480
is \tcode{false}, or
4474-
if the type \tcode{\exposid{single-sender-value-type}<Sndr, Env>}
4481+
if the type \tcode{\exposid{single-sender-value-type}<\linebreak{}\exposid{child-type}<Sndr>, \exposid{FWD-ENV-T}(Env)>}
44754482
is ill-formed or \tcode{void},
4476-
then the expression \tcode{stopped_as_optional.transform_sender(sndr, env)}
4483+
then the expression \tcode{stopped_as_optional.\linebreak{}transform_sender(sndr, env)}
44774484
is ill-formed;
44784485
otherwise, it is equivalent to:
44794486
\begin{codeblock}
44804487
auto&& [_, _, child] = sndr;
4481-
using V = @\exposid{single-sender-value-type}@<Sndr, Env>;
4488+
using V = @\exposid{single-sender-value-type}@<@\exposid{child-type}@<Sndr>, @\exposid{FWD-ENV-T}@(Env)>;
44824489
return let_stopped(
44834490
then(std::forward_like<Sndr>(child),
44844491
[]<class... Ts>(Ts&&... ts) noexcept(is_nothrow_constructible_v<V, Ts...>) {

0 commit comments

Comments
 (0)