-
Notifications
You must be signed in to change notification settings - Fork 214
Closed
Description
because asioexec completion token implementation doesn't perfect forward the reference, and asio::streambuf is non-copyable and non-movable.
stdexec/include/asioexec/completion_token.hpp
Lines 352 to 366 in 394a7c5
| template <typename Signatures, typename Initiation, typename... Args> | |
| class sender { | |
| using args_type_ = std::tuple<std::decay_t<Args>...>; | |
| public: | |
| using sender_concept = ::stdexec::sender_t; | |
| template <typename T, typename... Us> | |
| requires std::constructible_from<Initiation, T> | |
| && std::constructible_from<args_type_, Us...> | |
| explicit constexpr sender(T&& t, Us&&... us) noexcept( | |
| std::is_nothrow_constructible_v<Initiation, T> | |
| && std::is_nothrow_constructible_v<args_type_, Us...>) | |
| : init_(static_cast<T&&>(t)) | |
| , args_(static_cast<Us&&>(us)...) { | |
| } |
Code snippet to reproduce:
#include <asioexec/use_sender.hpp>
#include <boost/asio.hpp>
#include <stdexec/execution.hpp>
auto f(boost::asio::readable_pipe pipe, boost::asio::streambuf buf)
{
auto p = boost::asio::async_read(pipe, buf, asioexec::use_sender);
}compiler error messages
[build] ~/.cache/CPM/stdexec/ab26/stdexec/include/asioexec/completion_token.hpp:532:14: error: no matching constructor for initialization of '::asioexec::detail::completion_token::sender< ::asioexec::detail::completion_token::completion_signatures<void (boost::system::error_code, unsigned long)>, std::remove_cvref_t<boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<boost::asio::any_io_executor>>>, boost::asio::basic_streambuf<std::allocator<char>> &, boost::asio::detail::transfer_all_t>' (aka '::asioexec::detail::completion_token::sender< ::stdexec::completion_signatures< ::stdexec::set_value_t (boost::system::error_code, unsigned long), ::stdexec::set_error_t (std::exception_ptr), ::stdexec::set_stopped_t ()>, boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<boost::asio::any_io_executor>>, boost::asio::basic_streambuf<std::allocator<char>> &, boost::asio::detail::transfer_all_t>') [clang-diagnostic-error]
[build] 532 | return ::asioexec::detail::completion_token::sender<
[build] | ^
[build] 533 | ::asioexec::detail::completion_token::completion_signatures<Signatures...>,
[build] 534 | std::remove_cvref_t<Initiation>,
[build] 535 | Args...
[build] 536 | >(static_cast<Initiation&&>(i), static_cast<Args&&>(args)...);
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] ~/.cache/CPM/stdexec/ab26/stdexec/include/asioexec/use_sender.hpp:218:70: note: in instantiation of function template specialization 'boost::asio::async_result<asioexec::completion_token_t, void (boost::system::error_code, unsigned long)>::initiate<boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<>>, boost::asio::basic_streambuf<> &, boost::asio::detail::transfer_all_t>' requested here
[build] 218 | async_result<::asioexec::completion_token_t, Signatures...>::initiate(
[build] | ^
[build] ./build/vcpkg_installed/x64-linux-dynamic/include/boost/asio/async_result.hpp:644:61: note: in instantiation of function template specialization 'boost::asio::async_result<asioexec::use_sender_t, void (boost::system::error_code, unsigned long)>::initiate<boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<>>, boost::asio::basic_streambuf<> &, boost::asio::detail::transfer_all_t>' requested here
[build] 644 | async_result<decay_t<CompletionToken>, Signatures...>>::initiate(
[build] | ^
[build] ./build/vcpkg_installed/x64-linux-dynamic/include/boost/asio/read.hpp:1038:5: note: while substituting deduced template arguments into function template 'async_initiate' [with CompletionToken = const asioexec::use_sender_t &, Signatures = (no value), Initiation = boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<>>, Args = <boost::asio::basic_streambuf<> &, detail::transfer_all_t>]
[build] 1038 | async_initiate<ReadToken,
[build] | ^
[build] ./source/main.cpp:21:14: note: while substituting deduced template arguments into function template 'async_read' [with AsyncReadStream = boost::asio::readable_pipe, DynamicBuffer_v1 = boost::asio::streambuf &, ReadToken = const use_sender_t &]
[build] 21 | auto p = boost::asio::async_read(pipe, buf, asioexec::use_sender);
[build] | ^
[build] ~/.cache/CPM/stdexec/ab26/stdexec/include/asioexec/completion_token.hpp:361:26: note: candidate template ignored: constraints not satisfied [with T = boost::asio::detail::initiate_async_read_dynbuf_v1<boost::asio::basic_readable_pipe<>>, Us = <boost::asio::basic_streambuf<> &, boost::asio::detail::transfer_all_t>]
[build] 361 | explicit constexpr sender(T&& t, Us&&... us) noexcept(
[build] | ^
[build] ~/.cache/CPM/stdexec/ab26/stdexec/include/asioexec/completion_token.hpp:360:20: note: because 'std::constructible_from<args_type_, boost::asio::basic_streambuf<> &, boost::asio::detail::transfer_all_t>' evaluated to false
[build] 360 | && std::constructible_from<args_type_, Us...>
[build] | ^
[build] /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/concepts:162:30: note: because 'is_constructible_v<std::tuple<boost::asio::basic_streambuf<>, boost::asio::detail::transfer_all_t>, boost::asio::basic_streambuf<> &, boost::asio::detail::transfer_all_t>' evaluated to false
[build] 162 | = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
[build] | ^
It works fine with boost::asio::use_awaitable but not asioexec::use_sender.
Metadata
Metadata
Assignees
Labels
No labels