diff --git a/include/fmt/core.h b/include/fmt/core.h index 3097feee2007..bb67a9eac0c0 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1270,7 +1270,8 @@ template struct arg_mapper { FMT_CONSTEXPR FMT_INLINE auto map(const char_type* val) -> const char_type* { return val; } - template ::value)> + template ::value && !std::is_pointer::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> basic_string_view { static_assert(std::is_same>::value, @@ -1324,9 +1325,8 @@ template struct arg_mapper { // We use SFINAE instead of a const T* parameter to avoid conflicting with // the C array overload. - template - FMT_CONSTEXPR auto map(T) - -> enable_if_t::value, unformattable_pointer> { + template ::value)> + FMT_CONSTEXPR auto map(T) -> unformattable_pointer { return {}; } diff --git a/test/xchar-test.cc b/test/xchar-test.cc index 4e837aab401f..106840e6748f 100644 --- a/test/xchar-test.cc +++ b/test/xchar-test.cc @@ -87,6 +87,10 @@ TEST(xchar_test, format) { EXPECT_EQ(L"abc1", fmt::format(L"{}c{}", L"ab", 1)); } +TEST(xchar_test, is_formattable) { + static_assert(!fmt::is_formattable::value, ""); +} + TEST(xchar_test, compile_time_string) { #if defined(FMT_USE_STRING_VIEW) && __cplusplus >= 201703L EXPECT_EQ(L"42", fmt::format(FMT_STRING(std::wstring_view(L"{}")), 42));