diff --git a/include/asioexec/completion_token.hpp b/include/asioexec/completion_token.hpp index 193ae72aa..8068756fd 100644 --- a/include/asioexec/completion_token.hpp +++ b/include/asioexec/completion_token.hpp @@ -244,7 +244,7 @@ namespace asioexec { } template - void operator()(Args&&... args) && noexcept { + void operator()(Args&&... args) noexcept { STDEXEC_ASSERT(self_); { const std::lock_guard l(self_->m_); diff --git a/test/asioexec/test_completion_token.cpp b/test/asioexec/test_completion_token.cpp index af969d5ff..8d62154fc 100644 --- a/test/asioexec/test_completion_token.cpp +++ b/test/asioexec/test_completion_token.cpp @@ -718,4 +718,15 @@ namespace { CHECK(lvalue_kind == value_category_receiver::kind::const_lvalue); } + TEST_CASE( + "Lvalue invocation of the completion handler is supported (for compatibility with Boost.Beast " + "perhaps among others)", + "[asioexec][completion_token]") { + const auto initiating_function = [](auto&& token) { + return asio_impl::async_initiate([](auto&& h) { h(); }, token); + }; + auto op = ::stdexec::connect(initiating_function(completion_token), expect_value_receiver{}); + ::stdexec::start(op); + } + } // namespace