From c18e5f2276367f53a6ba496744983d517197ee57 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 4 Oct 2024 13:26:50 +0300 Subject: [PATCH] Move MSVC workarounds from test/Jamfile to to_array_rvalue_test.cpp --- test/Jamfile | 4 +--- test/to_array_rvalue_test.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/Jamfile b/test/Jamfile index 66c9d6a..991ce61 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -113,7 +113,5 @@ run function_ref_fn_noexcept_test.cpp ; run function_ref_mfn_noexcept_test.cpp ; run function_ref_obj_noexcept_test.cpp ; -# MSVC 14.0/14.1 C array rvalue references do not work run to_array_lvalue_test.cpp ; -run to_array_rvalue_test.cpp : : : - msvc-14.0:no msvc-14.1:no ; +run to_array_rvalue_test.cpp ; diff --git a/test/to_array_rvalue_test.cpp b/test/to_array_rvalue_test.cpp index 99960d2..4a443d2 100644 --- a/test/to_array_rvalue_test.cpp +++ b/test/to_array_rvalue_test.cpp @@ -4,12 +4,22 @@ #include #include +#include +#include +#include #include #include #include #include +#if defined(BOOST_MSVC) && BOOST_MSVC < 1910 + +BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC < 1910" ) +int main() {} + +#else + namespace compat = boost::compat; int main() @@ -37,7 +47,9 @@ int main() auto output = compat::to_array(std::move(input)); static_assert(std::is_same, 1>>::value, ""); BOOST_TEST_ALL_EQ(output[0].begin(), output[0].end(), vec.begin(), vec.end()); +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1920) BOOST_TEST(input[0].empty()); // input left in a moved-from state +#endif } { // const values work (although they don't result in an effective move) @@ -48,6 +60,7 @@ int main() BOOST_TEST_ALL_EQ(output[0].begin(), output[0].end(), vec.begin(), vec.end()); BOOST_TEST_ALL_EQ(input[0].begin(), input[0].end(), vec.begin(), vec.end()); // input not modified } +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1920) { // move-only types work std::unique_ptr input[] = {std::unique_ptr{new int(42)}}; @@ -57,6 +70,8 @@ int main() BOOST_TEST_EQ(output[0].get(), ptr); BOOST_TEST_EQ(input[0].get(), nullptr); // input left in a moved-from state } +#endif + { // constexpr check constexpr int input[] = {1, 2, 3}; @@ -69,3 +84,5 @@ int main() return boost::report_errors(); } + +#endif