diff --git a/include/fmt/format.h b/include/fmt/format.h index 0c861913..3378ff5d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3236,7 +3236,7 @@ class udl_formatter { # else template struct udl_formatter { - basic_string_view str; + const Char *str; template auto operator()(Args && ... args) const @@ -3277,9 +3277,9 @@ constexpr internal::udl_formatter operator""_format() { \endrst */ inline internal::udl_formatter -operator"" _format(const char *s, std::size_t n) { return {{s, n}}; } +operator"" _format(const char *s, std::size_t) { return {s}; } inline internal::udl_formatter -operator"" _format(const wchar_t *s, std::size_t n) { return {{s, n}}; } +operator"" _format(const wchar_t *s, std::size_t) { return {s}; } # endif // FMT_UDL_TEMPLATE /** diff --git a/test/format-test.cc b/test/format-test.cc index 916dcc47..57945a3e 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1469,11 +1469,6 @@ TEST(LiteralsTest, Format) { EXPECT_EQ(format("{}c{}", "ab", 1), udl_format); auto udl_format_w = L"{}c{}"_format(L"ab", 1); EXPECT_EQ(format(L"{}c{}", L"ab", 1), udl_format_w); - - auto udl_format_null_char = "{}c\0d{}"_format("ab", 1); - EXPECT_EQ(format("{}c\0d{}", "ab", 1), udl_format_null_char); - auto udl_format_w_null_char = L"{}c\0d{}"_format(L"ab", 1); - EXPECT_EQ(format(L"{}c\0d{}", L"ab", 1), udl_format_w_null_char); } TEST(LiteralsTest, NamedArg) { @@ -1534,7 +1529,6 @@ TEST(FormatTest, CustomArgFormatter) { TEST(FormatTest, NonNullTerminatedFormatString) { EXPECT_EQ("42", format(string_view("{}foo", 2), 42)); - EXPECT_EQ("42f\0oo", format(string_view("{}f\0oo", 6), 42)); } struct variant {