From b1a054706ee5b7989afa978b3f7a48a601556775 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 15 Nov 2024 08:26:34 -0800 Subject: [PATCH] Remove more MSVC 2015 workarounds and fix string_view checks --- test/base-test.cc | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/test/base-test.cc b/test/base-test.cc index 1ee0c657c78f..52089feadbaf 100644 --- a/test/base-test.cc +++ b/test/base-test.cc @@ -645,9 +645,7 @@ TEST(base_test, is_formattable) { EXPECT_TRUE(fmt::is_formattable::value); EXPECT_TRUE(fmt::is_formattable::value); -#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910 EXPECT_FALSE(fmt::is_formattable::value); -#endif EXPECT_FALSE(fmt::is_formattable::value); const auto f = convertible_to_pointer_formattable(); @@ -745,19 +743,6 @@ TEST(base_test, no_implicit_conversion_to_string_view) { fmt::is_formattable::value); } -#ifdef FMT_USE_STRING_VIEW -struct implicitly_convertible_to_std_string_view { - operator std::string_view() const { return "foo"; } -}; - -TEST(base_test, no_implicit_conversion_to_std_string_view) { - EXPECT_FALSE( - fmt::is_formattable::value); -} -#endif - -// std::is_constructible is broken in MSVC until version 2015. -#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1900 struct explicitly_convertible_to_string_view { explicit operator fmt::string_view() const { return "foo"; } }; @@ -769,7 +754,16 @@ TEST(base_test, format_explicitly_convertible_to_string_view) { !fmt::is_formattable::value, ""); } -# ifdef FMT_USE_STRING_VIEW +#if FMT_CPLUSPLUS >= 201703L +struct implicitly_convertible_to_std_string_view { + operator std::string_view() const { return "foo"; } +}; + +TEST(base_test, no_implicit_conversion_to_std_string_view) { + EXPECT_FALSE( + fmt::is_formattable::value); +} + struct explicitly_convertible_to_std_string_view { explicit operator std::string_view() const { return "foo"; } }; @@ -781,8 +775,7 @@ TEST(base_test, format_explicitly_convertible_to_std_string_view) { !fmt::is_formattable::value, ""); } -# endif -#endif +#endif // FMT_CPLUSPLUS >= 201703L TEST(base_test, has_formatter) { EXPECT_TRUE((fmt::detail::has_formatter()));