[libcxx-commits] [libcxx] 5517bc6 - [libc++][format] Improves the handle test.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 21 08:25:02 PDT 2022


Author: Mark de Wever
Date: 2022-06-21T17:24:57+02:00
New Revision: 5517bc6c4a05d715881d2b4e1dac9c7de244273d

URL: https://github.com/llvm/llvm-project/commit/5517bc6c4a05d715881d2b4e1dac9c7de244273d
DIFF: https://github.com/llvm/llvm-project/commit/5517bc6c4a05d715881d2b4e1dac9c7de244273d.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/test/std/utilities/format/format.functions/format_tests.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index d8ba8c5960d01..f6da95b55a07b 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -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;


        


More information about the libcxx-commits mailing list