Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beast::async_detect_ssl does not take lvalue arguments in Boost 1.70 RC2 #1569

Closed
KABoissonneault opened this issue Apr 12, 2019 · 0 comments

Comments

@KABoissonneault
Copy link

Someone posted this snippet on Slack, saying it doesn't compile

#include <boost/beast/core.hpp>

using boost::asio::ip::tcp;
namespace beast = boost::beast;
void good(tcp::socket & socket, beast::flat_buffer & buf)
{
    beast::async_detect_ssl(socket, buf, [](beast::error_code ec, bool uses_ssl){});
}

void bad(tcp::socket & socket, beast::flat_buffer & buf)
{
    
    auto h = [](beast::error_code ec, bool uses_ssl){};
    beast::async_detect_ssl(socket, buf, h);
        /* error: beast/core/detect_ssl.hpp:513:25: error: type ‘boost::beast::async_base<<lambda(boost::beast::error_code, bool)>&, boost::asio::executor, std::allocator<void> >’ is not a direct base of ‘boost::beast::detail::detect_ssl_op<<lambda(boost::beast::error_code, bool)>, boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> > >’
        */
}

I suspect this is because of the constructor of detect_ssl_op

template<class DetectHandler_>
    detect_ssl_op(
        DetectHandler_&& handler,
        AsyncReadStream& stream,
        DynamicBuffer& buffer)
        : beast::async_base<
            DetectHandler_,
            beast::executor_type<AsyncReadStream>>(
                std::forward<DetectHandler_>(handler),
                stream.get_executor())
        , stream_(stream)
        , buffer_(buffer)

async_base here is instantiated with DetectHandler_, which is not decayed, while the base class uses the decayed handler

@KABoissonneault KABoissonneault changed the title beast::async_detect_ssl does not take lvalue arguments beast::async_detect_ssl does not take lvalue arguments in Boost 1.70 RC2 Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant