Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/beman/execution/detail/let.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct impls_for<::beman::execution::detail::let_t<Completion>> : ::beman::execu
auto mkop{[&] {
return ::beman::execution::connect(
::std::apply(::std::move(state.fun),
state.args.template emplace<args_t>(::std::forward<Args>(args)...)),
::std::move(state.args.template emplace<args_t>(::std::forward<Args>(args)...))),
let_receiver<Receiver, decltype(state.env)>{receiver, state.env});
}};
::beman::execution::start(
Expand Down
1 change: 1 addition & 0 deletions tests/beman/execution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ list(
APPEND
execution_tests
issue-174.test
issue-186.test
exec-scope-counting.test
exec-spawn.test
exec-stop-when.test
Expand Down
34 changes: 34 additions & 0 deletions tests/beman/execution/issue-186.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <beman/execution/execution.hpp>
#include <cassert>

namespace ex = beman::execution;

namespace {
struct move_only_type {
move_only_type() : val(0) {}
explicit move_only_type(int v) : val(v) {}
~move_only_type() = default;

move_only_type(const move_only_type&) = delete;
move_only_type& operator=(const move_only_type&) = delete;

move_only_type& operator=(move_only_type&&) = default;
move_only_type(move_only_type&&) = default;
int val; // NOLINT
};
} // namespace

int main() {
auto snd = ex::just(move_only_type(1)) //
| ex::then([](move_only_type v) noexcept { return v.val * 2; }) //
| ex::let_value([](int v) noexcept { return ex::just(v * 3); }); // int
auto [ret] = ex::sync_wait(std::move(snd)).value();
assert(ret == 6);

// NOTE: Compile time error with move_only_type
auto snd2 = ex::just(move_only_type(1)) //
| ex::then([](move_only_type v) noexcept { return move_only_type{v.val * 2}; }) //
| ex::let_value([](move_only_type v) noexcept { return ex::just(v.val * 3); }); // move_only_type
auto [ret2] = ex::sync_wait(std::move(snd2)).value();
assert(ret2 == 6);
}