Skip to content

Commit

Permalink
Remove more MSVC 2015 workarounds and fix string_view checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Nov 15, 2024
1 parent bfd9539 commit f232fbc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/base-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,7 @@ TEST(base_test, is_formattable) {
EXPECT_TRUE(fmt::is_formattable<const const_formattable&>::value);

EXPECT_TRUE(fmt::is_formattable<nonconst_formattable&>::value);
#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
EXPECT_FALSE(fmt::is_formattable<const nonconst_formattable&>::value);
#endif

EXPECT_FALSE(fmt::is_formattable<convertible_to_pointer>::value);
const auto f = convertible_to_pointer_formattable();
Expand Down Expand Up @@ -745,7 +743,7 @@ TEST(base_test, no_implicit_conversion_to_string_view) {
fmt::is_formattable<implicitly_convertible_to_string_view>::value);
}

#ifdef FMT_USE_STRING_VIEW
#ifdef FMT_CPLUSPLUS >= 201703L
struct implicitly_convertible_to_std_string_view {
operator std::string_view() const { return "foo"; }
};
Expand All @@ -754,10 +752,8 @@ TEST(base_test, no_implicit_conversion_to_std_string_view) {
EXPECT_FALSE(
fmt::is_formattable<implicitly_convertible_to_std_string_view>::value);
}
#endif
#endif // FMT_CPLUSPLUS >= 201703L

// 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"; }
};
Expand All @@ -769,7 +765,7 @@ TEST(base_test, format_explicitly_convertible_to_string_view) {
!fmt::is_formattable<explicitly_convertible_to_string_view>::value, "");
}

# ifdef FMT_USE_STRING_VIEW
#ifdef FMT_CPLUSPLUS >= 201703L
struct explicitly_convertible_to_std_string_view {
explicit operator std::string_view() const { return "foo"; }
};
Expand All @@ -781,8 +777,7 @@ TEST(base_test, format_explicitly_convertible_to_std_string_view) {
!fmt::is_formattable<explicitly_convertible_to_std_string_view>::value,
"");
}
# endif
#endif
#endif // FMT_CPLUSPLUS >= 201703L

TEST(base_test, has_formatter) {
EXPECT_TRUE((fmt::detail::has_formatter<const const_formattable, char>()));
Expand Down

0 comments on commit f232fbc

Please sign in to comment.