mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-23 09:49:42 +00:00
Fix handling of exotic character types
This commit is contained in:
parent
684e2fdc94
commit
1266c2b600
@ -1285,8 +1285,14 @@ template <typename Context> struct arg_mapper {
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(T val) -> char_type {
|
||||
return val;
|
||||
}
|
||||
template <typename T, FMT_ENABLE_IF(std::is_same<T, wchar_t>::value &&
|
||||
!std::is_same<wchar_t, char_type>::value)>
|
||||
template <typename T, enable_if_t<(std::is_same<T, wchar_t>::value ||
|
||||
#ifdef __cpp_char8_t
|
||||
std::is_same<T, char8_t>::value ||
|
||||
#endif
|
||||
std::is_same<T, char16_t>::value ||
|
||||
std::is_same<T, char32_t>::value) &&
|
||||
!std::is_same<T, char_type>::value,
|
||||
int> = 0>
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(T) -> unformattable_char {
|
||||
return {};
|
||||
}
|
||||
|
@ -739,6 +739,11 @@ TEST(core_test, is_formattable) {
|
||||
static_assert(fmt::is_formattable<const signed char*>::value, "");
|
||||
static_assert(fmt::is_formattable<const unsigned char*>::value, "");
|
||||
static_assert(!fmt::is_formattable<wchar_t>::value, "");
|
||||
#ifdef __cpp_char8_t
|
||||
static_assert(!fmt::is_formattable<char8_t>::value, "");
|
||||
#endif
|
||||
static_assert(!fmt::is_formattable<char16_t>::value, "");
|
||||
static_assert(!fmt::is_formattable<char32_t>::value, "");
|
||||
static_assert(!fmt::is_formattable<const wchar_t*>::value, "");
|
||||
static_assert(!fmt::is_formattable<const wchar_t[3]>::value, "");
|
||||
static_assert(!fmt::is_formattable<fmt::basic_string_view<wchar_t>>::value,
|
||||
|
Loading…
Reference in New Issue
Block a user