diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index c56199223d610..10429fc8eda3e 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -246,7 +246,7 @@ template void for_each(Tuple&& tup, F&& f) { for_each(indexes, std::forward(tup), std::forward(f)); } -#if FMT_MSC_VERSION +#if FMT_MSC_VERSION && FMT_MSC_VERSION < 1920 // Older MSVC doesn't get the reference type correctly for arrays. template struct range_reference_type_impl { using type = decltype(*detail::range_begin(std::declval())); @@ -396,15 +396,18 @@ template struct formatter< R, Char, enable_if_t< - fmt::is_range::value -// Workaround a bug in MSVC 2019 and earlier. -#if !FMT_MSC_VERSION - && - (is_formattable>, - Char>::value || - detail::has_fallback_formatter< - detail::uncvref_type>, Char>::value) + conjunction +// Workaround a bug in MSVC 2017 and earlier. +#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1920 + , + disjunction< + is_formattable>, + Char>, + detail::has_fallback_formatter< + detail::uncvref_type>, Char> + > #endif + >::value >> { using range_type = detail::maybe_const_range; @@ -457,14 +460,20 @@ struct formatter< template struct formatter< T, Char, - enable_if_t::value -// Workaround a bug in MSVC 2019 and earlier. -#if !FMT_MSC_VERSION - && (is_formattable, Char>::value || - detail::has_fallback_formatter, Char>::value) - && (is_formattable, Char>::value || - detail::has_fallback_formatter, Char>::value) + enable_if_t +// Workaround a bug in MSVC 2017 and earlier. +#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1920 + , + disjunction< + is_formattable, Char>, + detail::has_fallback_formatter, Char> + >, + disjunction< + is_formattable, Char>, + detail::has_fallback_formatter, Char> + > #endif + >::value >> { template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {