From 1d036585ccea8a57dc5fdc84406181db3d1f3205 Mon Sep 17 00:00:00 2001 From: Dmitry Kobets <89153909+dmitrykobets-msft@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:10:15 -0700 Subject: [PATCH] Add testcase for #1100 (#1101) --- tests/span_tests.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index efe0195..5a9fc6e 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1380,3 +1380,16 @@ TEST(span_test, std_span) EXPECT_TRUE(std_span.size() == gsl_span.size()); } #endif // defined(FORCE_STD_SPAN_TESTS) || defined(__cpp_lib_span) && __cpp_lib_span >= 202002L + +#if defined(__cpp_lib_span) && defined(__cpp_lib_ranges) +// This test covers the changes in PR #1100 +TEST(span_test, msvc_compile_error_PR1100) +{ + int arr[]{1, 7, 2, 9}; + gsl::span sp{arr, std::size(arr)}; + std::ranges::sort(sp); + for (const auto& e : sp) { + (void)e; + } +} +#endif // defined(__cpp_lib_span) && defined(__cpp_lib_ranges)