diff --git a/include/gsl/span b/include/gsl/span index f61fd11..3f82a5e 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -777,8 +777,15 @@ span(const Container&) -> span; #endif // ( defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) ) #if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND) +#if defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" // Bug in clang-cl.exe which raises a C++17 -Wdeprecated warning about this static constexpr workaround in C++14 mode. +#endif // defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L) template constexpr const typename span::size_type span::extent; +#if defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L) +#pragma clang diagnostic pop +#endif // defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L) #endif namespace details diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7a00fec..493285c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -121,7 +121,12 @@ if(MSVC) # MSVC or simulating MSVC ) check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID) if (WARN_RESERVED_ID) - target_compile_options(gsl_tests_config INTERFACE "-Wno-reserved-identifier") + target_compile_options(gsl_tests_config INTERFACE "-Wno-reserved-identifier") + endif() + check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) + if (WARN_UNSAFE_BUFFER) + # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" + target_compile_options(gsl_tests_config INTERFACE "-Wno-unsafe-buffer-usage") endif() else() target_compile_options(gsl_tests_config INTERFACE @@ -255,7 +260,12 @@ if(MSVC) # MSVC or simulating MSVC ) check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID) if (WARN_RESERVED_ID) - target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-reserved-identifier") + target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-reserved-identifier") + endif() + check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER) + if (WARN_UNSAFE_BUFFER) + # This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer" + target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-unsafe-buffer-usage") endif() else() target_compile_options(gsl_tests_config_noexcept INTERFACE