Skip to content

Commit 3c97389

Browse files
committed
fix dependent sender computation in write_env's completion signatures
1 parent 48c90f1 commit 3c97389

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

include/stdexec/__detail/__write_env.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ namespace stdexec {
6767
};
6868

6969
static constexpr auto get_completion_signatures =
70-
[]<class _Self, class... _Env>(_Self&&, _Env&&...) noexcept
71-
-> __completion_signatures_of_t<
72-
__child_of<_Self>,
73-
__meval<__join_env_t, const __decay_t<__data_of<_Self>>&, _Env...>
74-
> {
70+
[]<class _Self, class... _Env>(_Self &&, _Env &&...) noexcept
71+
-> __completion_signatures_of_t<
72+
__child_of<_Self>,
73+
__meval<__join_env_t, const __decay_t<__data_of<_Self>> &,
74+
_Env>...> {
7575
static_assert(sender_expr_for<_Self, write_env_t>);
7676
return {};
7777
};

test/exec/test_task.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ namespace {
3737
// This is a work-around for clang-12 bugs in Release mode
3838
thread_local int __thread_id = 0;
3939

40+
static_assert(stdexec::sender<exec::task<void>>);
41+
4042
// This is a work-around for apple clang bugs in Release mode
4143
STDEXEC_WHEN(STDEXEC_APPLE_CLANG(), [[clang::optnone]]) auto get_id() -> int {
4244
return __thread_id;
@@ -257,6 +259,17 @@ namespace {
257259
CHECK(count == 3);
258260
}
259261

262+
TEST_CASE("task - can co_await task wrapped in write_env", "[types][task]") {
263+
stdexec::sync_wait([]() -> exec::task<void> {
264+
co_await stdexec::write_env(
265+
[]() -> exec::task<void> {
266+
auto token = co_await stdexec::get_stop_token();
267+
assert(!token.stop_possible());
268+
}(),
269+
stdexec::prop{stdexec::get_stop_token, stdexec::never_stop_token{}});
270+
}());
271+
}
272+
260273
struct test_domain {
261274
template <sender_expr_for<then_t> _Sender>
262275
static constexpr auto transform_sender(_Sender&&) noexcept {

0 commit comments

Comments
 (0)