From 49c61d2551fefa974b2971e7f00e71288fa1b38e Mon Sep 17 00:00:00 2001 From: Carson Radtke Date: Wed, 29 Jan 2025 18:16:08 -0600 Subject: [PATCH] fix tests for pre-C++17 --- tests/span_tests.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index a7072c6f..e41026e7 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -412,7 +412,7 @@ TEST(span_test, from_std_array_constructor) static_assert(!CtorCompilesFor, std::array&>, "!CtorCompilesFor, std::array&>"); -#if !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L) +#if !defined(_MSC_VER) || (_MSC_VER > 1943) || (__cplusplus >= 201703L) // Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14". static_assert(!ConversionCompilesFor, std::array>, "!ConversionCompilesFor, std::array>"); @@ -529,7 +529,7 @@ TEST(span_test, from_container_constructor) EXPECT_TRUE(cs.data() == cstr.data()); } -#if !defined(_MSC_VER) || (_MSC_VER > 1942) || (__cplusplus >= 201703L) +#if !defined(_MSC_VER) || (_MSC_VER > 1943) || (__cplusplus >= 201703L) // Fails on "Visual Studio 16 2019/Visual Studio 17 2022, windows-2019/2022, Debug/Release, 14". static_assert(!ConversionCompilesFor, std::vector>, "!ConversionCompilesFor, std::vector>"); @@ -1293,9 +1293,15 @@ TEST(span_test, empty_span) TEST(span_test, conversions) { int arr[5] = {1, 2, 3, 4, 5}; - span s = arr; +#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) + span s = arr; span cs = s; +#else + span s = arr; + span cs = s; +#endif + EXPECT_TRUE(cs.size() == s.size()); EXPECT_TRUE(cs.data() == s.data());