From 6c6b1fbf6ef62e4109e139c4cbd6db5cae804e8f Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Sun, 31 Jul 2022 00:46:31 +0500 Subject: [PATCH] Workaround a bug in MSVC Signed-off-by: Vladislav Shchapov --- include/fmt/ranges.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 2e5a8e68..076a78b8 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -419,6 +419,15 @@ template using maybe_const_range = conditional_t::value, const R, R>; +// Workaround a bug in MSVC 2015 and earlier. +#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910 +template +struct is_formattable_delayed + : disjunction< + is_formattable>, Char>, + has_fallback_formatter>, Char>> {}; +#endif + } // namespace detail template @@ -582,19 +591,14 @@ struct range_format_kind template struct formatter< R, Char, - enable_if_t::value != - range_format::disabled> -// 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>> + enable_if_t::value != + range_format::disabled> +// Workaround a bug in MSVC 2015 and earlier. +#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910 + , + detail::is_formattable_delayed #endif - >::value>> + >::value>> : detail::range_default_formatter::value, R, Char> { };