[libcxx-commits] [libcxx] 3a1b178 - [libcxx][test] Portably test that `{w, }format_context` is a specialization of `basic_format_context`
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 19 11:36:51 PST 2022
Author: Casey Carter
Date: 2022-01-19T11:36:29-08:00
New Revision: 3a1b178a0b8bb4291be163f707d19c55bbab1b4a
URL: https://github.com/llvm/llvm-project/commit/3a1b178a0b8bb4291be163f707d19c55bbab1b4a
DIFF: https://github.com/llvm/llvm-project/commit/3a1b178a0b8bb4291be163f707d19c55bbab1b4a.diff
LOG: [libcxx][test] Portably test that `{w,}format_context` is a specialization of `basic_format_context`
Differential Revision: https://reviews.llvm.org/D117606
Added:
Modified:
libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
index 13eb467095b63..457aff231baec 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
@@ -107,12 +107,21 @@ constexpr void test() {
test<std::back_insert_iterator<std::basic_string<char32_t>>, char32_t>();
}
-static_assert(std::is_same_v<
- std::format_context,
- std::basic_format_context<
- std::back_insert_iterator<std::basic_string<char>>, char>>);
+template <class, class>
+constexpr bool is_basic_format_context_specialization = false;
+template <class It, class CharT>
+constexpr bool is_basic_format_context_specialization<std::basic_format_context<It, CharT>, CharT> = true;
+
+static_assert(is_basic_format_context_specialization<std::format_context, char>);
+LIBCPP_STATIC_ASSERT(
+ std::is_same_v<
+ std::format_context,
+ std::basic_format_context<
+ std::back_insert_iterator<std::basic_string<char>>, char>>);
+
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
-static_assert(
+static_assert(is_basic_format_context_specialization<std::wformat_context, wchar_t>);
+LIBCPP_STATIC_ASSERT(
std::is_same_v<
std::wformat_context,
std::basic_format_context<
More information about the libcxx-commits
mailing list