From 638e2d1244a3655e90f343c45ef27ff562540b61 Mon Sep 17 00:00:00 2001 From: Richard Hodges Date: Thu, 30 Apr 2020 13:45:04 +0200 Subject: [PATCH] Fix compilation errors with msvc /std:c++latest fixes #1916 fixes #1925 --- CHANGELOG.md | 1 + .../beast/_experimental/http/impl/icy_stream.hpp | 4 ++-- .../boost/beast/_experimental/test/impl/stream.hpp | 4 ++-- include/boost/beast/core/detail/impl/read.hpp | 2 +- include/boost/beast/core/detail/read.hpp | 2 +- include/boost/beast/core/impl/basic_stream.hpp | 14 +++++++------- .../boost/beast/core/impl/buffered_read_stream.hpp | 4 ++-- include/boost/beast/core/impl/flat_stream.hpp | 4 ++-- include/boost/beast/http/impl/file_body_win32.hpp | 2 +- include/boost/beast/http/impl/read.hpp | 8 ++++---- include/boost/beast/http/impl/write.hpp | 12 ++++++------ include/boost/beast/ssl/ssl_stream.hpp | 4 ++-- include/boost/beast/websocket/impl/accept.hpp | 12 ++++++------ include/boost/beast/websocket/impl/close.hpp | 2 +- include/boost/beast/websocket/impl/handshake.hpp | 4 ++-- include/boost/beast/websocket/impl/ping.hpp | 4 ++-- include/boost/beast/websocket/impl/read.hpp | 6 +++--- include/boost/beast/websocket/impl/write.hpp | 4 ++-- include/boost/beast/websocket/stream.hpp | 6 +++--- test/beast/core/async_base.cpp | 2 +- test/beast/core/stream_traits.cpp | 8 ++++---- 21 files changed, 55 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f5d8c5..6e1890a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +* Fix compile errors on Visual Studio with /std:c++latest * Fix standalone compilation error with std::string_view * OpenSSL 1.0.2 or later is required * Fix c++20 deprecation warning in span_body diff --git a/include/boost/beast/_experimental/http/impl/icy_stream.hpp b/include/boost/beast/_experimental/http/impl/icy_stream.hpp index 9b6e66ab..c2760c55 100644 --- a/include/boost/beast/_experimental/http/impl/icy_stream.hpp +++ b/include/boost/beast/_experimental/http/impl/icy_stream.hpp @@ -259,7 +259,7 @@ read_some(MutableBufferSequence const& buffers, error_code& ec) template template< class MutableBufferSequence, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) icy_stream:: async_read_some( @@ -311,7 +311,7 @@ write_some(MutableBufferSequence const& buffers, error_code& ec) template template< class MutableBufferSequence, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) icy_stream:: async_write_some( diff --git a/include/boost/beast/_experimental/test/impl/stream.hpp b/include/boost/beast/_experimental/test/impl/stream.hpp index 3925d742..5ca612d3 100644 --- a/include/boost/beast/_experimental/test/impl/stream.hpp +++ b/include/boost/beast/_experimental/test/impl/stream.hpp @@ -306,7 +306,7 @@ read_some(MutableBufferSequence const& buffers, return 0; } -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) stream:: async_read_some( @@ -386,7 +386,7 @@ write_some( return n; } -template +template BOOST_BEAST_ASYNC_RESULT2(WriteHandler) stream:: async_write_some( diff --git a/include/boost/beast/core/detail/impl/read.hpp b/include/boost/beast/core/detail/impl/read.hpp index 37249792..842af609 100644 --- a/include/boost/beast/core/detail/impl/read.hpp +++ b/include/boost/beast/core/detail/impl/read.hpp @@ -214,7 +214,7 @@ template< class AsyncReadStream, class DynamicBuffer, class CompletionCondition, - class ReadHandler, + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler, class> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) async_read( diff --git a/include/boost/beast/core/detail/read.hpp b/include/boost/beast/core/detail/read.hpp index 3f7c17f2..91a02b83 100644 --- a/include/boost/beast/core/detail/read.hpp +++ b/include/boost/beast/core/detail/read.hpp @@ -219,7 +219,7 @@ template< class AsyncReadStream, class DynamicBuffer, class CompletionCondition, - class ReadHandler + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler #if ! BOOST_BEAST_DOXYGEN , class = typename std::enable_if< is_async_read_stream::value && diff --git a/include/boost/beast/core/impl/basic_stream.hpp b/include/boost/beast/core/impl/basic_stream.hpp index 0e70f7ce..36bd6b84 100644 --- a/include/boost/beast/core/impl/basic_stream.hpp +++ b/include/boost/beast/core/impl/basic_stream.hpp @@ -776,7 +776,7 @@ close() //------------------------------------------------------------------------------ template -template +template BOOST_BEAST_ASYNC_RESULT1(ConnectHandler) basic_stream:: async_connect( @@ -795,7 +795,7 @@ async_connect( template template< class EndpointSequence, - class RangeConnectHandler, + BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler, class> BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void(error_code, typename Protocol::endpoint)) basic_stream:: @@ -817,7 +817,7 @@ template template< class EndpointSequence, class ConnectCondition, - class RangeConnectHandler, + BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler, class> BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void (error_code, typename Protocol::endpoint)) basic_stream:: @@ -839,7 +839,7 @@ async_connect( template template< class Iterator, - class IteratorConnectHandler> + BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler> BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator)) basic_stream:: async_connect( @@ -860,7 +860,7 @@ template template< class Iterator, class ConnectCondition, - class IteratorConnectHandler> + BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler> BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator)) basic_stream:: async_connect( @@ -881,7 +881,7 @@ async_connect( //------------------------------------------------------------------------------ template -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) basic_stream:: async_read_some( @@ -901,7 +901,7 @@ async_read_some( } template -template +template BOOST_BEAST_ASYNC_RESULT2(WriteHandler) basic_stream:: async_write_some( diff --git a/include/boost/beast/core/impl/buffered_read_stream.hpp b/include/boost/beast/core/impl/buffered_read_stream.hpp index 21e23f71..097deace 100644 --- a/include/boost/beast/core/impl/buffered_read_stream.hpp +++ b/include/boost/beast/core/impl/buffered_read_stream.hpp @@ -141,7 +141,7 @@ buffered_read_stream(Args&&... args) } template -template +template BOOST_BEAST_ASYNC_RESULT2(WriteHandler) buffered_read_stream:: async_write_some( @@ -212,7 +212,7 @@ read_some(MutableBufferSequence const& buffers, } template -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) buffered_read_stream:: async_read_some( diff --git a/include/boost/beast/core/impl/flat_stream.hpp b/include/boost/beast/core/impl/flat_stream.hpp index f99ec026..4551a59e 100644 --- a/include/boost/beast/core/impl/flat_stream.hpp +++ b/include/boost/beast/core/impl/flat_stream.hpp @@ -144,7 +144,7 @@ read_some(MutableBufferSequence const& buffers, error_code& ec) template template< class MutableBufferSequence, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) flat_stream:: async_read_some( @@ -225,7 +225,7 @@ write_some(ConstBufferSequence const& buffers, error_code& ec) template template< class ConstBufferSequence, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) flat_stream:: async_write_some( diff --git a/include/boost/beast/http/impl/file_body_win32.hpp b/include/boost/beast/http/impl/file_body_win32.hpp index 32929d41..cba7a0ed 100644 --- a/include/boost/beast/http/impl/file_body_win32.hpp +++ b/include/boost/beast/http/impl/file_body_win32.hpp @@ -597,7 +597,7 @@ write_some( template< class Protocol, class Executor, bool isRequest, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write_some( net::basic_stream_socket< diff --git a/include/boost/beast/http/impl/read.hpp b/include/boost/beast/http/impl/read.hpp index ba265a57..3c11a9ca 100644 --- a/include/boost/beast/http/impl/read.hpp +++ b/include/boost/beast/http/impl/read.hpp @@ -304,7 +304,7 @@ template< class AsyncReadStream, class DynamicBuffer, bool isRequest, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) async_read_some( AsyncReadStream& stream, @@ -373,7 +373,7 @@ template< class AsyncReadStream, class DynamicBuffer, bool isRequest, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) async_read_header( AsyncReadStream& stream, @@ -443,7 +443,7 @@ template< class AsyncReadStream, class DynamicBuffer, bool isRequest, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) async_read( AsyncReadStream& stream, @@ -531,7 +531,7 @@ template< class AsyncReadStream, class DynamicBuffer, bool isRequest, class Body, class Allocator, - class ReadHandler> + BOOST_BEAST_ASYNC_TPARAM2 ReadHandler> BOOST_BEAST_ASYNC_RESULT2(ReadHandler) async_read( AsyncReadStream& stream, diff --git a/include/boost/beast/http/impl/write.hpp b/include/boost/beast/http/impl/write.hpp index ebf74b2d..671108da 100644 --- a/include/boost/beast/http/impl/write.hpp +++ b/include/boost/beast/http/impl/write.hpp @@ -463,7 +463,7 @@ write_some_impl( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write_some_impl( AsyncWriteStream& stream, @@ -526,7 +526,7 @@ write_some( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write_some( AsyncWriteStream& stream, @@ -608,7 +608,7 @@ write_header( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write_header( AsyncWriteStream& stream, @@ -681,7 +681,7 @@ write( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write( AsyncWriteStream& stream, @@ -801,7 +801,7 @@ write( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write( AsyncWriteStream& stream, @@ -830,7 +830,7 @@ async_write( template< class AsyncWriteStream, bool isRequest, class Body, class Fields, - class WriteHandler> + BOOST_BEAST_ASYNC_TPARAM2 WriteHandler> BOOST_BEAST_ASYNC_RESULT2(WriteHandler) async_write( AsyncWriteStream& stream, diff --git a/include/boost/beast/ssl/ssl_stream.hpp b/include/boost/beast/ssl/ssl_stream.hpp index cab2463d..2ab88816 100644 --- a/include/boost/beast/ssl/ssl_stream.hpp +++ b/include/boost/beast/ssl/ssl_stream.hpp @@ -555,7 +555,7 @@ public: need to ensure that all data is written before the asynchronous operation completes. */ - template + template BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void(boost::system::error_code, std::size_t)) async_write_some(ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler) @@ -636,7 +636,7 @@ public: if you need to ensure that the requested amount of data is read before the asynchronous operation completes. */ - template + template BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void(boost::system::error_code, std::size_t)) async_read_some(MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) diff --git a/include/boost/beast/websocket/impl/accept.hpp b/include/boost/beast/websocket/impl/accept.hpp index 538819b2..ef33c09b 100644 --- a/include/boost/beast/websocket/impl/accept.hpp +++ b/include/boost/beast/websocket/impl/accept.hpp @@ -542,7 +542,7 @@ accept( template template< - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept( @@ -564,7 +564,7 @@ async_accept( template template< class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept_ex( @@ -590,7 +590,7 @@ async_accept_ex( template template< class ConstBufferSequence, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept( @@ -621,7 +621,7 @@ template template< class ConstBufferSequence, class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept_ex( @@ -654,7 +654,7 @@ async_accept_ex( template template< class Body, class Allocator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept( @@ -678,7 +678,7 @@ template template< class Body, class Allocator, class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) stream:: async_accept_ex( diff --git a/include/boost/beast/websocket/impl/close.hpp b/include/boost/beast/websocket/impl/close.hpp index d59374cc..2b7d7293 100644 --- a/include/boost/beast/websocket/impl/close.hpp +++ b/include/boost/beast/websocket/impl/close.hpp @@ -382,7 +382,7 @@ close(close_reason const& cr, error_code& ec) } template -template +template BOOST_BEAST_ASYNC_RESULT1(CloseHandler) stream:: async_close(close_reason const& cr, CloseHandler&& handler) diff --git a/include/boost/beast/websocket/impl/handshake.hpp b/include/boost/beast/websocket/impl/handshake.hpp index 645b1a3a..8fabe1ec 100644 --- a/include/boost/beast/websocket/impl/handshake.hpp +++ b/include/boost/beast/websocket/impl/handshake.hpp @@ -268,7 +268,7 @@ do_handshake( //------------------------------------------------------------------------------ template -template +template BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) stream:: async_handshake( @@ -293,7 +293,7 @@ async_handshake( } template -template +template BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) stream:: async_handshake( diff --git a/include/boost/beast/websocket/impl/ping.hpp b/include/boost/beast/websocket/impl/ping.hpp index 6f92d7c7..eef9983b 100644 --- a/include/boost/beast/websocket/impl/ping.hpp +++ b/include/boost/beast/websocket/impl/ping.hpp @@ -288,7 +288,7 @@ pong(ping_data const& payload, error_code& ec) } template -template +template BOOST_BEAST_ASYNC_RESULT1(WriteHandler) stream:: async_ping(ping_data const& payload, WriteHandler&& handler) @@ -306,7 +306,7 @@ async_ping(ping_data const& payload, WriteHandler&& handler) } template -template +template BOOST_BEAST_ASYNC_RESULT1(WriteHandler) stream:: async_pong(ping_data const& payload, WriteHandler&& handler) diff --git a/include/boost/beast/websocket/impl/read.hpp b/include/boost/beast/websocket/impl/read.hpp index 4e03baae..5087cf54 100644 --- a/include/boost/beast/websocket/impl/read.hpp +++ b/include/boost/beast/websocket/impl/read.hpp @@ -804,7 +804,7 @@ read(DynamicBuffer& buffer, error_code& ec) } template -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) stream:: async_read(DynamicBuffer& buffer, ReadHandler&& handler) @@ -878,7 +878,7 @@ read_some( } template -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) stream:: async_read_some( @@ -1263,7 +1263,7 @@ loop: } template -template +template BOOST_BEAST_ASYNC_RESULT2(ReadHandler) stream:: async_read_some( diff --git a/include/boost/beast/websocket/impl/write.hpp b/include/boost/beast/websocket/impl/write.hpp index 2a82b677..b76441d3 100644 --- a/include/boost/beast/websocket/impl/write.hpp +++ b/include/boost/beast/websocket/impl/write.hpp @@ -700,7 +700,7 @@ write_some(bool fin, } template -template +template BOOST_BEAST_ASYNC_RESULT2(WriteHandler) stream:: async_write_some(bool fin, @@ -756,7 +756,7 @@ write(ConstBufferSequence const& buffers, error_code& ec) } template -template +template BOOST_BEAST_ASYNC_RESULT2(WriteHandler) stream:: async_write( diff --git a/include/boost/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp index 5b17061a..b3bc22f7 100644 --- a/include/boost/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -2634,7 +2634,7 @@ public: template< class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) async_accept_ex( ResponseDecorator const& decorator, @@ -2643,7 +2643,7 @@ public: template< class ConstBufferSequence, class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) async_accept_ex( ConstBufferSequence const& buffers, @@ -2656,7 +2656,7 @@ public: template< class Body, class Allocator, class ResponseDecorator, - class AcceptHandler> + BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler> BOOST_BEAST_ASYNC_RESULT1(AcceptHandler) async_accept_ex( http::request + template typename net::async_result::return_type async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler) { diff --git a/test/beast/core/stream_traits.cpp b/test/beast/core/stream_traits.cpp index 4498837a..348ff9ff 100644 --- a/test/beast/core/stream_traits.cpp +++ b/test/beast/core/stream_traits.cpp @@ -214,14 +214,14 @@ public: struct async_read_stream { net::io_context::executor_type get_executor() noexcept; - template + template void async_read_some(MutableBufferSequence const&, ReadHandler&&); }; struct async_write_stream { net::io_context::executor_type get_executor() noexcept; - template + template void async_write_some(ConstBufferSequence const&, WriteHandler&&); }; @@ -232,9 +232,9 @@ public: struct async_stream : async_read_stream, async_write_stream { net::io_context::executor_type get_executor() noexcept; - template + template void async_read_some(MutableBufferSequence const&, ReadHandler&&); - template + template void async_write_some(ConstBufferSequence const&, WriteHandler&&); };