This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Tentatively Ready status.
task::connect()Section: 33.13.6.2 [task.class] Status: Tentatively Ready Submitter: Dietmar Kühl Opened: 2025-08-31 Last modified: 2025-10-27
Priority: Not Prioritized
View other active issues in [task.class].
View all other issues in [task.class].
View all issues with Tentatively Ready status.
Discussion:
Addresses US 244-375
Coroutines can't be copied. Thus, a task can be
connect() just once. To represent that
task::connect() should be rvalue reference qualified
but currently it isn't.
[2025-10-17; Reflector poll.]
Set status to Tentatively Ready after five votes in favour during reflector poll.
"It's nice to rvalue qualify such a function, but it is not strictly necessary."
Proposed resolution:
In the synopsis in 33.13.6.2 [task.class] add rvalue
reference qualification to task::connect():
namespace std::execution {
template<class T, class Environment>
class task {
...
template<receiver Rcvr>
state<Rcvr> connect(Rcvr&& rcvr) &&;
...
}
}
In the specification in 33.13.6.3 [task.members] paragraph 3 add rvalue
reference qualification to task::connect():
template<receiver Rcvr> state<Rcvr> connect(Rcvr&& rcvr) &&;-3- Precondition:
bool(handle)istrue.-4- Effects: Equivalent to:
return state<Rcvr>(exchange(handle, {}), std::forward<Rcvr>(recv));