diff --git a/include/exec/static_thread_pool.hpp b/include/exec/static_thread_pool.hpp index 918fca6f4..615a194a7 100644 --- a/include/exec/static_thread_pool.hpp +++ b/include/exec/static_thread_pool.hpp @@ -1652,7 +1652,7 @@ namespace experimental::execution struct opstate_base_with_receiver : opstate_base { explicit opstate_base_with_receiver(Range range, _static_thread_pool& pool, Receiver rcvr) - : opstate_base{range, pool} + : opstate_base{std::move(range), pool} , rcvr_(static_cast(rcvr)) {} diff --git a/test/exec/test_static_thread_pool.cpp b/test/exec/test_static_thread_pool.cpp index 485745063..44cb6ad21 100644 --- a/test/exec/test_static_thread_pool.cpp +++ b/test/exec/test_static_thread_pool.cpp @@ -168,6 +168,19 @@ TEST_CASE("schedule_all on static_thread_pool handles empty ranges", "[types][st CHECK(ex::sync_wait(std::move(sender))); } +TEST_CASE("schedule_all on static_thread_pool accepts move-only ranges", + "[types][static_thread_pool]") +{ + exec::static_thread_pool pool{1}; + int sum = 0; + auto sender = exec::schedule_all(pool, std::views::all(std::vector{1, 2, 3})) + | exec::transform_each(ex::then([&sum](int value) noexcept { sum += value; })) + | exec::ignore_all_values(); + + CHECK(ex::sync_wait(std::move(sender))); + CHECK(sum == 6); +} + #if !STDEXEC_NO_STDCPP_EXCEPTIONS() TEST_CASE("schedule_all on static_thread_pool sends errors from set_next", "[types][static_thread_pool]")