diff --git a/include/beman/execution/detail/as_awaitable.hpp b/include/beman/execution/detail/as_awaitable.hpp index e97cca55..0119d693 100644 --- a/include/beman/execution/detail/as_awaitable.hpp +++ b/include/beman/execution/detail/as_awaitable.hpp @@ -42,7 +42,7 @@ namespace beman::execution { */ struct as_awaitable_t { template - auto operator()(Expr&& expr, Promise& promise) const { + auto operator()(Expr&& expr, Promise& promise) const -> decltype(auto) { if constexpr (requires { ::std::forward(expr).as_awaitable(promise); }) { static_assert( ::beman::execution::detail::is_awaitable(expr).as_awaitable(promise)), diff --git a/include/beman/execution/detail/let.hpp b/include/beman/execution/detail/let.hpp index c5812099..c75065ce 100644 --- a/include/beman/execution/detail/let.hpp +++ b/include/beman/execution/detail/let.hpp @@ -10,6 +10,7 @@ import std; #else #include #include +#include #include #include #include @@ -271,12 +272,9 @@ struct let_t { {}}; }}; template - static auto - let_bind(auto& state, Receiver& receiver, Args&&... args) noexcept(noexcept(::beman::execution::connect( - ::std::apply(::std::move(state.fun), - ::std::move(state.args.template emplace<::beman::execution::detail::decayed_tuple>( - ::std::forward(args)...))), - let_receiver{receiver, state.env}))) { + static auto let_bind(auto& state, Receiver& receiver, Args&&... args) noexcept( + noexcept(::beman::execution::connect(::std::invoke(::std::move(state.fun), ::std::forward(args)...), + let_receiver{receiver, state.env}))) { using args_t = ::beman::execution::detail::decayed_tuple; auto mkop{[&] { return ::beman::execution::connect( diff --git a/include/beman/execution/detail/run_loop.hpp b/include/beman/execution/detail/run_loop.hpp index bdb9360d..2e71b38f 100644 --- a/include/beman/execution/detail/run_loop.hpp +++ b/include/beman/execution/detail/run_loop.hpp @@ -175,10 +175,8 @@ class run_loop { } } auto finish() -> void { - { - ::std::lock_guard guard(this->mutex); - this->current_state = state::finishing; - } + ::std::lock_guard guard(this->mutex); + this->current_state = state::finishing; this->condition.notify_one(); } }; diff --git a/tests/beman/execution/exec-spawn.test.cpp b/tests/beman/execution/exec-spawn.test.cpp index 8120b486..c51474d0 100644 --- a/tests/beman/execution/exec-spawn.test.cpp +++ b/tests/beman/execution/exec-spawn.test.cpp @@ -10,6 +10,8 @@ import beman.execution; import beman.execution.detail; #else +#include +#include #include #include #include @@ -188,11 +190,15 @@ auto test_spawn() { ASSERT(associated == false); ASSERT(disassociated == false); } + static_assert(requires { + test_std::spawn(test_std::just_error(0) | test_std::let_error([](int) noexcept { return test_std::just(); }), + std::declval>()); + }); } } // namespace -TEST(exec_spawn_future) { +TEST(exec_spawn) { static_assert(std::same_as); test_overload(sender{}, token{}, env{}); test_overload(sender{}, token{}, env{});