mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-22 02:20:06 +00:00
Pass correct Char to base format_as formatter (#3457)
This commit is contained in:
parent
d8f04e3995
commit
171a020c82
@ -4104,8 +4104,8 @@ class format_int {
|
||||
|
||||
template <typename T, typename Char>
|
||||
struct formatter<T, Char, enable_if_t<detail::has_format_as<T>::value>>
|
||||
: private formatter<detail::format_as_t<T>> {
|
||||
using base = formatter<detail::format_as_t<T>>;
|
||||
: private formatter<detail::format_as_t<T>, Char> {
|
||||
using base = formatter<detail::format_as_t<T>, Char>;
|
||||
using base::parse;
|
||||
|
||||
template <typename FormatContext>
|
||||
|
@ -152,6 +152,15 @@ TEST(xchar_test, vformat_to) {
|
||||
EXPECT_EQ(L"42", w);
|
||||
}
|
||||
|
||||
namespace test {
|
||||
struct struct_as_wstring_view {};
|
||||
auto format_as(struct_as_wstring_view) -> fmt::wstring_view { return L"foo"; }
|
||||
} // namespace test
|
||||
|
||||
TEST(xchar_test, format_as) {
|
||||
EXPECT_EQ(fmt::format(L"{}", test::struct_as_wstring_view()), L"foo");
|
||||
}
|
||||
|
||||
TEST(format_test, wide_format_to_n) {
|
||||
wchar_t buffer[4];
|
||||
buffer[3] = L'x';
|
||||
|
Loading…
Reference in New Issue
Block a user