chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.72k stars 1.19k forks source link

deferred doesn't work with bind_executor + bind_allocator #1429

Open anarthal opened 4 months ago

anarthal commented 4 months ago

This fails:

#include <boost/asio/bind_executor.hpp>
#include <boost/asio/system_executor.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/bind_allocator.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/deferred.hpp>

namespace asio = boost::asio;

int main() {
    asio::io_context ctx;

    asio::post(asio::deferred)(
        asio::bind_executor(
            ctx.get_executor(),
            asio::bind_allocator(
                std::allocator<void>(),
                []{}
            )
        ));
}

https://godbolt.org/z/Kv7s1vx6n