diff --git a/include/fmt/core.h b/include/fmt/core.h index 75304d04..649e728f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -949,9 +949,9 @@ struct fallback_formatter { }; // Specifies if T has an enabled fallback_formatter specialization. -template +template using has_fallback_formatter = - std::is_constructible>; + std::is_constructible>; struct view {}; @@ -1224,7 +1224,7 @@ template struct arg_mapper { FMT_ENABLE_IF( std::is_constructible, T>::value && !is_string::value && !has_formatter::value && - !has_fallback_formatter::value)> + !has_fallback_formatter::value)> FMT_CONSTEXPR FMT_INLINE basic_string_view map(const T& val) { return basic_string_view(val); } @@ -1234,7 +1234,7 @@ template struct arg_mapper { std::is_constructible, T>::value && !std::is_constructible, T>::value && !is_string::value && !has_formatter::value && - !has_fallback_formatter::value)> + !has_fallback_formatter::value)> FMT_CONSTEXPR FMT_INLINE basic_string_view map(const T& val) { return std_string_view(val); } @@ -1279,7 +1279,7 @@ template struct arg_mapper { template ::value && !has_formatter::value && - !has_fallback_formatter::value)> + !has_fallback_formatter::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(std::declval().map( static_cast::type>(val))) { @@ -1288,7 +1288,7 @@ template struct arg_mapper { template ::value && !is_char::value && (has_formatter::value || - has_fallback_formatter::value))> + has_fallback_formatter::value))> FMT_CONSTEXPR FMT_INLINE const T& map(const T& val) { return val; } @@ -1578,9 +1578,11 @@ FMT_MODULE_EXPORT_END FMT_MODULE_EXPORT_BEGIN template -using is_formattable = bool_constant>().map(std::declval())), - detail::unformattable>::value>; +using is_formattable = bool_constant< + !std::is_same>().map( + std::declval())), + detail::unformattable>::value && + !detail::has_fallback_formatter::value>; /** \rst diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index f04be5ba..367d7a6b 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -331,15 +331,14 @@ template struct is_range { template struct formatter< T, Char, - enable_if_t::value + enable_if_t< + fmt::is_range::value // Workaround a bug in MSVC 2017 and earlier. #if !FMT_MSC_VER || FMT_MSC_VER >= 1927 - && - (has_formatter, format_context>::value || - detail::has_fallback_formatter, - format_context>::value) + && (has_formatter, format_context>::value || + detail::has_fallback_formatter, Char>::value) #endif - >> { + >> { formatting_range formatting; template