diff --git a/include/exec/start_now.hpp b/include/exec/start_now.hpp index f5f02e02e..b44523168 100644 --- a/include/exec/start_now.hpp +++ b/include/exec/start_now.hpp @@ -77,6 +77,7 @@ namespace experimental::execution constexpr __storage_base(_Env&& __env, std::size_t __pending) : __pending_(__pending) + , __joiner_(__pending == 0 ? nullptr : &__empty_joiner_) , __env_(__mkenv(static_cast<_Env&&>(__env), __source_)) {} diff --git a/test/exec/async_scope/test_start_now.cpp b/test/exec/async_scope/test_start_now.cpp index 47f1c80c3..d4d1c1131 100644 --- a/test/exec/async_scope/test_start_now.cpp +++ b/test/exec/async_scope/test_start_now.cpp @@ -26,6 +26,14 @@ namespace REQUIRE(executed); } + TEST_CASE("start_now zero", "[async_scope][start_now]") + { + async_scope scope; + auto stg = start_now(scope); + + REQUIRE(sync_wait(stg.async_wait()).has_value()); + } + TEST_CASE("start_now two", "[async_scope][start_now]") { bool executedA{false};