diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 10429fc8..0010f49e 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -390,23 +390,33 @@ using range_formatter_type = conditional_t< template using maybe_const_range = conditional_t::value, const R, R>; + +template +struct is_not_recursive_range : std::bool_constant< + !std::is_same, R>::value> {}; + +template +struct is_formattable_delayed : is_formattable< + detail::uncvref_type>, Char> { +}; + +template +struct has_fallback_formatter_delayed : detail::has_fallback_formatter< + detail::uncvref_type>, Char> { +}; + } // namespace detail template struct formatter< R, Char, enable_if_t< - 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 + conjunction, + detail::is_not_recursive_range, + disjunction< + detail::is_formattable_delayed, + detail::has_fallback_formatter_delayed + > >::value >> {