From 19f91bcb32ced1449a7bcacfbfc5f3ea6aee3a53 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 1 Nov 2022 02:44:58 +0800 Subject: [PATCH] Tests adopting asio code changes for asio 1.25.0. --- .../boost/beast/core/detail/work_guard.hpp | 6 ++--- include/boost/beast/core/stream_traits.hpp | 2 +- test/beast/core/async_base.cpp | 25 +++++++++++++++++++ test/beast/core/bind_handler.cpp | 10 +++----- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/include/boost/beast/core/detail/work_guard.hpp b/include/boost/beast/core/detail/work_guard.hpp index 13a2267d..f3021782 100644 --- a/include/boost/beast/core/detail/work_guard.hpp +++ b/include/boost/beast/core/detail/work_guard.hpp @@ -34,9 +34,9 @@ struct select_work_guard template struct execution_work_guard { - using executor_type = decltype( - net::prefer(std::declval(), - net::execution::outstanding_work.tracked)); + using executor_type = typename std::decay(), + net::execution::outstanding_work.tracked))>::type; execution_work_guard(Executor const& exec) : ex_(net::prefer(exec, net::execution::outstanding_work.tracked)) diff --git a/include/boost/beast/core/stream_traits.hpp b/include/boost/beast/core/stream_traits.hpp index f1945ea9..e6c6ecec 100644 --- a/include/boost/beast/core/stream_traits.hpp +++ b/include/boost/beast/core/stream_traits.hpp @@ -111,7 +111,7 @@ using executor_type = #else template using executor_type = - decltype(std::declval().get_executor()); + typename std::decay().get_executor())>::type; #endif /** Determine if `T` has the `get_executor` member function. diff --git a/test/beast/core/async_base.cpp b/test/beast/core/async_base.cpp index 6c9a3f90..7a4cd1b7 100644 --- a/test/beast/core/async_base.cpp +++ b/test/beast/core/async_base.cpp @@ -107,6 +107,11 @@ struct nested_alloc struct allocator_type { }; + + allocator_type get_allocator() const noexcept + { + return allocator_type{}; + } }; struct intrusive_alloc @@ -114,11 +119,21 @@ struct intrusive_alloc struct allocator_type { }; + + allocator_type get_allocator() const noexcept + { + return allocator_type{}; + } }; struct no_ex { using executor_type = net::system_executor; + + executor_type get_executor() const noexcept + { + return executor_type{}; + } }; struct nested_ex @@ -126,6 +141,11 @@ struct nested_ex struct executor_type { }; + + executor_type get_executor() const noexcept + { + return executor_type{}; + } }; struct intrusive_ex @@ -133,6 +153,11 @@ struct intrusive_ex struct executor_type { }; + + executor_type get_executor() const noexcept + { + return executor_type{}; + } }; template diff --git a/test/beast/core/bind_handler.cpp b/test/beast/core/bind_handler.cpp index 4c0b071b..92a79e76 100644 --- a/test/beast/core/bind_handler.cpp +++ b/test/beast/core/bind_handler.cpp @@ -186,7 +186,7 @@ public: if (blocking_ == net::execution::blocking.possibly) { s_.on_invoke(); - net::execution::execute(ex_, std::forward(f)); + ex_.execute(std::forward(f)); } else { @@ -220,11 +220,9 @@ public: dispatch(F&& f, Alloc const& a) { s_.on_invoke(); - net::execution::execute( - net::prefer(ex_, - net::execution::blocking.possibly, - net::execution::allocator(a)), - std::forward(f)); + net::prefer(ex_, + net::execution::blocking.possibly, + net::execution::allocator(a)).execute(std::forward(f)); // previously equivalent to // ex_.dispatch(std::forward(f), a); }