[libcxx-commits] [libcxx] [libc++] Guard unchecked uses of wchar_t and char8_t in tests (PR #229255)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 5 15:53:09 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libcxx/test/libcxx/algorithms/specialized_algorithms.compile.pass.cpp libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp libcxx/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp libcxx/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturating_div.compile.pass.cpp libcxx/test/std/numerics/numeric.ops/numeric.ops.sat/saturating_sub.compile.pass.cpp libcxx/test/std/re/re.iter/re.tokiter/types.pass.cpp libcxx/test/std/re/re.regex/re.regex.const/constants.pass.cpp libcxx/test/std/re/re.regex/types.pass.cpp libcxx/test/std/re/re.results/re.results.size/max_size.pass.cpp libcxx/test/std/re/re.results/types.pass.cpp libcxx/test/std/strings/string.view/enable_borrowed_range.compile.pass.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp
index c1e0fe4a7..3320b440e 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp
@@ -24,15 +24,15 @@
 
 int main(int, char**)
 {
-    static_assert((std::is_base_of<std::locale::facet, std::num_get<char> >::value), "");
-    static_assert((std::is_same<std::num_get<char>::char_type, char>::value), "");
-    static_assert((std::is_same<std::num_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::num_get<char> >::value), "");
+  static_assert((std::is_same<std::num_get<char>::char_type, char>::value), "");
+  static_assert((std::is_same<std::num_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-    static_assert((std::is_base_of<std::locale::facet, std::num_get<wchar_t> >::value), "");
-    static_assert((std::is_same<std::num_get<wchar_t>::char_type, wchar_t>::value), "");
-    static_assert((std::is_same<std::num_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::num_get<wchar_t> >::value), "");
+  static_assert((std::is_same<std::num_get<wchar_t>::char_type, wchar_t>::value), "");
+  static_assert((std::is_same<std::num_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
 #endif
 
-    return 0;
+  return 0;
 }
diff --git a/libcxx/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp b/libcxx/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp
index 84cff8592..7baf4ec7e 100644
--- a/libcxx/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp
@@ -31,17 +31,17 @@
 
 int main(int, char**)
 {
-    static_assert((std::is_base_of<std::locale::facet, std::time_get<char> >::value), "");
-    static_assert((std::is_base_of<std::time_base, std::time_get<char> >::value), "");
-    static_assert((std::is_same<std::time_get<char>::char_type, char>::value), "");
-    static_assert((std::is_same<std::time_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::time_get<char> >::value), "");
+  static_assert((std::is_base_of<std::time_base, std::time_get<char> >::value), "");
+  static_assert((std::is_same<std::time_get<char>::char_type, char>::value), "");
+  static_assert((std::is_same<std::time_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-    static_assert((std::is_base_of<std::locale::facet, std::time_get<wchar_t> >::value), "");
-    static_assert((std::is_base_of<std::time_base, std::time_get<wchar_t> >::value), "");
-    static_assert((std::is_same<std::time_get<wchar_t>::char_type, wchar_t>::value), "");
-    static_assert((std::is_same<std::time_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::time_get<wchar_t> >::value), "");
+  static_assert((std::is_base_of<std::time_base, std::time_get<wchar_t> >::value), "");
+  static_assert((std::is_same<std::time_get<wchar_t>::char_type, wchar_t>::value), "");
+  static_assert((std::is_same<std::time_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
 #endif
 
-    return 0;
+  return 0;
 }
diff --git a/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp b/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp
index 072496393..012e31c48 100644
--- a/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp
@@ -24,15 +24,15 @@
 
 int main(int, char**)
 {
-    static_assert((std::is_base_of<std::locale::facet, std::time_put<char> >::value), "");
-    static_assert((std::is_same<std::time_put<char>::char_type, char>::value), "");
-    static_assert((std::is_same<std::time_put<char>::iter_type, std::ostreambuf_iterator<char> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::time_put<char> >::value), "");
+  static_assert((std::is_same<std::time_put<char>::char_type, char>::value), "");
+  static_assert((std::is_same<std::time_put<char>::iter_type, std::ostreambuf_iterator<char> >::value), "");
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-    static_assert((std::is_base_of<std::locale::facet, std::time_put<wchar_t> >::value), "");
-    static_assert((std::is_same<std::time_put<wchar_t>::char_type, wchar_t>::value), "");
-    static_assert((std::is_same<std::time_put<wchar_t>::iter_type, std::ostreambuf_iterator<wchar_t> >::value), "");
+  static_assert((std::is_base_of<std::locale::facet, std::time_put<wchar_t> >::value), "");
+  static_assert((std::is_same<std::time_put<wchar_t>::char_type, wchar_t>::value), "");
+  static_assert((std::is_same<std::time_put<wchar_t>::iter_type, std::ostreambuf_iterator<wchar_t> >::value), "");
 #endif
 
-    return 0;
+  return 0;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/229255


More information about the libcxx-commits mailing list