diff options
Diffstat (limited to '3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp')
-rw-r--r-- | 3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp b/3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp index fbd88209972..613732c5128 100644 --- a/3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp +++ b/3rdparty/asio/src/tests/unit/windows/random_access_handle.cpp @@ -2,7 +2,7 @@ // random_access_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -47,6 +47,7 @@ void test() try { io_context ioc; + const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; asio::uint64_t offset = 0; @@ -57,42 +58,45 @@ void test() win::random_access_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; +#if defined(ASIO_MSVC) && (_MSC_VER < 1910) + // Skip this on older MSVC due to mysterious ambiguous overload errors. +#else win::random_access_handle handle2(ioc, native_handle1); +#endif -#if defined(ASIO_HAS_MOVE) - win::random_access_handle handle3(std::move(handle2)); -#endif // defined(ASIO_HAS_MOVE) + win::random_access_handle handle3(ioc_ex); + HANDLE native_handle2 = INVALID_HANDLE_VALUE; + win::random_access_handle handle4(ioc_ex, native_handle2); + + win::random_access_handle handle5(std::move(handle4)); + + win::basic_random_access_handle<io_context::executor_type> handle6(ioc); + win::random_access_handle handle7(std::move(handle6)); // basic_random_access_handle operators. -#if defined(ASIO_HAS_MOVE) handle1 = win::random_access_handle(ioc); - handle1 = std::move(handle2); -#endif // defined(ASIO_HAS_MOVE) + handle1 = std::move(handle4); + handle1 = std::move(handle6); // basic_io_object functions. -#if !defined(ASIO_NO_DEPRECATED) - io_context& ioc_ref = handle1.get_io_context(); - (void)ioc_ref; -#endif !defined(ASIO_NO_DEPRECATED) - - io_context::executor_type ex = handle1.get_executor(); + windows::random_access_handle::executor_type ex = handle1.get_executor(); (void)ex; - // basic_handle functions. + // basic_overlapped_handle functions. win::random_access_handle::lowest_layer_type& lowest_layer = handle1.lowest_layer(); (void)lowest_layer; - const win::random_access_handle& handle4 = handle1; + const win::random_access_handle& handle8 = handle1; const win::random_access_handle::lowest_layer_type& lowest_layer2 - = handle4.lowest_layer(); + = handle8.lowest_layer(); (void)lowest_layer2; - HANDLE native_handle2 = INVALID_HANDLE_VALUE; - handle1.assign(native_handle2); + HANDLE native_handle3 = INVALID_HANDLE_VALUE; + handle1.assign(native_handle3); bool is_open = handle1.is_open(); (void)is_open; @@ -100,9 +104,16 @@ void test() handle1.close(); handle1.close(ec); - win::random_access_handle::native_handle_type native_handle3 + win::random_access_handle::native_handle_type native_handle4 + = handle1.release(); + (void)native_handle4; + win::random_access_handle::native_handle_type native_handle5 + = handle1.release(ec); + (void)native_handle5; + + win::random_access_handle::native_handle_type native_handle6 = handle1.native_handle(); - (void)native_handle3; + (void)native_handle6; handle1.cancel(); handle1.cancel(ec); @@ -147,5 +158,5 @@ void test() ASIO_TEST_SUITE ( "windows/random_access_handle", - ASIO_TEST_CASE(windows_random_access_handle_compile::test) + ASIO_COMPILE_TEST_CASE(windows_random_access_handle_compile::test) ) |