[libc++][format] Improves the handle test.

A formatter using a handle only needs to satisfy the BasicFormatter
requirements. The current test allowed more than that minimum. Changed
it to the minimum to make sure it works.

This was due to a post-commit review comment of @vitaut in D121530.

Reviewed By: ldionne, vitaut, #libc

Differential Revision: https://reviews.llvm.org/D127767
This commit is contained in:
Mark de Wever 2022-06-14 19:25:42 +02:00
parent 3f8e4169c1
commit 5517bc6c4a
1 changed files with 3 additions and 2 deletions

View File

@ -55,7 +55,7 @@ template <class CharT>
struct std::formatter<status, CharT> {
int type = 0;
constexpr auto parse(auto& parse_ctx) -> decltype(parse_ctx.begin()) {
constexpr auto parse(basic_format_parse_context<CharT>& parse_ctx) -> decltype(parse_ctx.begin()) {
auto begin = parse_ctx.begin();
auto end = parse_ctx.end();
if (begin == end)
@ -83,7 +83,8 @@ struct std::formatter<status, CharT> {
return begin;
}
auto format(status s, auto& ctx) -> decltype(ctx.out()) {
template <class Out>
auto format(status s, basic_format_context<Out, CharT>& ctx) -> decltype(ctx.out()) {
const char* names[] = {"foo", "bar", "foobar"};
char buffer[6];
const char* begin;