diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/types.compile.pass.cpp b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/types.compile.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// 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 + +// [container.adaptors.format]/1 +// For each of queue, priority_queue, and stack, the library provides the +// following formatter specialization where adaptor-type is the name of the +// template: +// template Container, class... U> +// struct formatter, charT>; +// +// Note it is unspecified in which header the adaptor formatters reside. In +// libc++ they are in . However their own headers are still required for +// the declarations of these types. + +// [format.formatter.spec]/4 +// If the library provides an explicit or partial specialization of +// formatter, 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. The test does not use the formattable +// concept to be similar to tests for formatters not provided by the +// header. + +#include +#include +#include +#include + +#include "test_macros.h" + +static_assert(std::semiregular, char>>); +static_assert(std::semiregular, char>>); +static_assert(std::semiregular, char>>); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +static_assert(std::semiregular, wchar_t>>); +static_assert(std::semiregular, wchar_t>>); +static_assert(std::semiregular, wchar_t>>); +#endif // TEST_HAS_NO_WIDE_CHARACTERS diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp @@ -18,10 +18,10 @@ // formatter, 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. +// Test parts of the BasicFormatter requirements. Like the formattable concept +// it uses the semiregular concept. This test does not use the formattable +// concept since the intent is for the formatter to be available without +// including the header. // TODO FMT Evaluate what to do with [format.formatter.spec]/2 // [format.formatter.spec]/2 diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/types.compile.pass.cpp copy from libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp copy to libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/types.compile.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/types.compile.pass.cpp +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/types.compile.pass.cpp @@ -7,21 +7,21 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 // UNSUPPORTED: libcpp-has-no-incomplete-format +// UNSUPPORTED: no-threads -// +// -// template requires is-vector-bool-reference -// struct formatter; +// template struct formatter; // [format.formatter.spec]/4 // If the library provides an explicit or partial specialization of // formatter, 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. +// Test parts of the BasicFormatter requirements. Like the formattable concept +// it uses the semiregular concept. This test does not use the formattable +// concept since the intent is for the formatter to be available without +// including the header. // TODO FMT Evaluate what to do with [format.formatter.spec]/2 // [format.formatter.spec]/2 @@ -31,11 +31,11 @@ // Note this should be discussed in LEWG. #include -#include +#include #include "test_macros.h" -static_assert(std::semiregular::reference, char>>); +static_assert(std::semiregular>); #ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::semiregular::reference, wchar_t>>); +static_assert(std::semiregular>); #endif diff --git a/libcxx/test/std/utilities/format/types.compile.pass.cpp b/libcxx/test/std/utilities/format/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/format/types.compile.pass.cpp @@ -0,0 +1,138 @@ +//===----------------------------------------------------------------------===// +// 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 +// UNSUPPORTED: libcpp-has-no-incomplete-format + +// + +// C++20 +// ... provides the following enabled specializations: +// The debug-enabled specializations +// template<> struct formatter; +// template<> struct formatter; +// template<> struct formatter; +// +// For each charT, the debug-enabled string type specializations template<> +// struct formatter; +// template<> struct formatter; +// template struct formatter; +// template +// struct formatter, charT>; +// template +// struct formatter, charT>; +// +// For each charT, for each cv-unqualified arithmetic type ArithmeticT other +// than char, wchar_t, char8_t, char16_t, or char32_t, a specialization +// template<> struct formatter; +// +// For each charT, the pointer type specializations template<> struct +// formatter; +// template<> struct formatter; +// template<> struct formatter; + +// C++23 +// [format.range.formatter] +// template +// requires same_as, T> && formattable +// class range_formatter; +// +// [format.tuple]/1 +// For each of pair and tuple, the library provides the following formatter +// specialization where pair-or-tuple is the name of the template: +// template... Ts> +// struct formatter, charT> { + +// [format.formatter.spec]/4 +// If the library provides an explicit or partial specialization of +// formatter, that specialization is enabled and meets the +// Formatter requirements except as noted otherwise. +// +// Test parts of the BasicFormatter requirements. Like the formattable concept +// it uses the semiregular concept. This test does not use the formattable +// concept since the intent is for the formatter to be available without +// including the header. + +#include +#include + +#include "test_macros.h" + +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +#if TEST_STD_VER > 20 +static_assert(std::semiregular>); +static_assert(std::semiregular, char>>); +static_assert(std::semiregular, char>>); +#endif + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +static_assert(std::semiregular>); +static_assert(std::semiregular>); +static_assert(std::semiregular>); + +# if TEST_STD_VER > 20 +static_assert(std::semiregular>); +static_assert(std::semiregular, wchar_t>>); +static_assert(std::semiregular, wchar_t>>); +# endif +#endif // TEST_HAS_NO_WIDE_CHARACTERS