diff --git a/include/fmt/format.h b/include/fmt/format.h index aae28016..92826799 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4104,8 +4104,8 @@ class format_int { template struct formatter::value>> - : private formatter> { - using base = formatter>; + : private formatter, Char> { + using base = formatter, Char>; using base::parse; template diff --git a/test/xchar-test.cc b/test/xchar-test.cc index b5cf3351..f80997d6 100644 --- a/test/xchar-test.cc +++ b/test/xchar-test.cc @@ -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';