diff --git a/include/fmt/base.h b/include/fmt/base.h index 80a31442..16dc37ad 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -1108,19 +1108,14 @@ struct use_formatter !use_format_as::value> {}; template -constexpr auto has_formatter_impl(T*) +auto has_formatter_impl(T* p) -> decltype(formatter, Char>().format( - std::declval(), - std::declval&>()), - true) { - return true; -} -template constexpr auto has_formatter_impl(...) -> bool { - return false; -} + *p, std::declval&>()), + std::true_type()); +template auto has_formatter_impl(...) -> std::false_type; // T can be const-qualified to check if it is const-formattable. template constexpr auto has_formatter() -> bool { - return has_formatter_impl(static_cast(nullptr)); + return decltype(has_formatter_impl(static_cast(nullptr)))::value; } template