[libcxx-commits] [PATCH] D127767: [libc++][format] Improves the handle test.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 14 10:29:45 PDT 2022

Mordante created this revision.
Mordante added reviewers: ldionne, vitaut.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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 <https://reviews.llvm.org/D121530>.

  rG LLVM Github Monorepo



Index: libcxx/test/std/utilities/format/format.functions/format_tests.h
--- libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -55,7 +55,7 @@
 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 @@
     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;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127767.436847.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220614/9592ca0b/attachment.bin>

More information about the libcxx-commits mailing list