[libcxx-commits] [PATCH] D117606: [libcxx][test] Portably test that `{w, }format_context` is a specialization of `basic_format_context`

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 18 17:16:01 PST 2022


CaseyCarter updated this revision to Diff 401053.
CaseyCarter added a comment.

Address review


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117606

Files:
  libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp


Index: libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
+++ libcxx/test/std/utilities/format/format.formatter/format.context/types.compile.pass.cpp
@@ -107,12 +107,21 @@
   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<


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117606.401053.patch
Type: text/x-patch
Size: 1393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220119/f7c5c832/attachment-0001.bin>


More information about the libcxx-commits mailing list