[libcxx-commits] [PATCH] D149543: [libc++][format] Fixes vector<bool> requirements.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 30 07:49:08 PDT 2023


Mordante updated this revision to Diff 518312.
Mordante added a comment.

CI fixes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149543/new/

https://reviews.llvm.org/D149543

Files:
  libcxx/include/vector
  libcxx/test/libcxx/transitive_includes/cxx2b.csv
  libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp


Index: libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// UNSUPPORTED: libcpp-has-no-incomplete-format
+
+// <vector>
+
+// template<class T, class charT> requires is-vector-bool-reference<T>
+//  struct formatter<T, charT>;
+
+// [format.formatter.spec]/4
+//   If the library provides an explicit or partial specialization of
+//   formatter<T, charT>, that specialization is enabled and meets the
+//   Formatter requirements except as noted otherwise.
+//
+// Tests parts of the BasicFormatter requirements. Like the formattable concept
+// it uses the semiregular concept. It test does not use the formattable
+// concept since it is the intention the formatter is available without
+// including the format header.
+
+// TODO FMT Evaluate what to do with [format.formatter.spec]/2
+// [format.formatter.spec]/2
+//   Each header that declares the template formatter provides the following
+//   enabled specializations:
+// Then there is a list of formatters, but is that really useful?
+// Note this should be discussed in LEWG.
+
+#include <concepts>
+#include <vector>
+
+static_assert(std::semiregular<std::formatter<std::vector<bool>::reference, char>>);
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+static_assert(std::semiregular<std::formatter<std::vector<bool>::reference, wchar_t>>);
+#endif
Index: libcxx/test/libcxx/transitive_includes/cxx2b.csv
===================================================================
--- libcxx/test/libcxx/transitive_includes/cxx2b.csv
+++ libcxx/test/libcxx/transitive_includes/cxx2b.csv
@@ -646,15 +646,21 @@
 variant new
 variant tuple
 variant version
+vector array
+vector cerrno
 vector climits
 vector compare
 vector cstddef
 vector cstdint
+vector cstdlib
 vector cstring
 vector initializer_list
 vector iosfwd
 vector limits
+vector locale
 vector new
 vector stdexcept
+vector string
+vector string_view
 vector tuple
 vector version
Index: libcxx/include/vector
===================================================================
--- libcxx/include/vector
+++ libcxx/include/vector
@@ -292,7 +292,6 @@
 #include <__config>
 #include <__debug>
 #include <__format/enable_insertable.h>
-#include <__format/formatter.h>
 #include <__functional/hash.h>
 #include <__functional/unary_function.h>
 #include <__iterator/advance.h>
@@ -323,6 +322,13 @@
 #include <stdexcept>
 #include <version>
 
+// TODO FMT Make these normal includes after transitive includes are
+// removed from older language versions.
+#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER >= 23
+#  include <__format/formatter.h>
+#  include <__format/formatter_bool.h>
+#endif
+
 // standard-mandated includes
 
 // [iterator.range]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149543.518312.patch
Type: text/x-patch
Size: 3324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230430/1535bba9/attachment-0001.bin>


More information about the libcxx-commits mailing list