[libcxx-commits] [libcxx] [libc++] Implement the `<type_traits>` parts of P1317R2 (PR #151480)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 31 02:32:38 PDT 2025


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 HEAD~1 HEAD --extensions ,h,inc,cpp -- libcxx/include/__type_traits/is_applicable.h libcxx/test/std/utilities/meta/meta.rel/is_applicable.compile.pass.cpp libcxx/test/std/utilities/meta/meta.rel/is_nothrow_applicable.compile.pass.cpp libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/apply_result.compile.pass.cpp libcxx/include/type_traits libcxx/modules/std/type_traits.inc libcxx/test/libcxx/type_traits/no_specializations.verify.cpp libcxx/test/std/utilities/meta/derived_from_integral_constant.compile.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__type_traits/is_applicable.h b/libcxx/include/__type_traits/is_applicable.h
index fc97a0c4a..c79671ac3 100644
--- a/libcxx/include/__type_traits/is_applicable.h
+++ b/libcxx/include/__type_traits/is_applicable.h
@@ -61,7 +61,7 @@ consteval auto __applicability_traits_of() {
   if constexpr (__tuple_like<_Tuple>)
     return []<size_t... _Is>(index_sequence<_Is...>) {
       constexpr bool __is_tuple_applicable = requires(_Fn&& __fn, _Tuple&& __tuple) {
-        std::invoke(static_cast<_Fn&&>(__fn), std::get<_Is>(static_cast<_Tuple&&>(__tuple))...);
+        std::invoke(static_cast<_Fn &&>(__fn), std::get<_Is>(static_cast<_Tuple &&>(__tuple))...);
       };
       if constexpr (__is_tuple_applicable)
         return __applicability_traits<
diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_applicable.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_applicable.compile.pass.cpp
index bd8531c02..7f70f1904 100644
--- a/libcxx/test/std/utilities/meta/meta.rel/is_applicable.compile.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.rel/is_applicable.compile.pass.cpp
@@ -423,18 +423,18 @@ void test_invalid_nontuple_types() {
 
   // test built-in array
   test_is_applicable_from_function<void(int), int[1], false>();
-  test_is_applicable_from_function<void(int), int(&)[1], false>();
+  test_is_applicable_from_function<void(int), int (&)[1], false>();
   test_is_applicable_from_function<void(int), const int[1], false>();
-  test_is_applicable_from_function<void(int), const int(&)[1], false>();
+  test_is_applicable_from_function<void(int), const int (&)[1], false>();
   test_is_applicable_from_function<void(int) noexcept, int[1], false>();
-  test_is_applicable_from_function<void(int) noexcept, int(&)[1], false>();
+  test_is_applicable_from_function<void(int) noexcept, int (&)[1], false>();
   test_is_applicable_from_function<void(int) noexcept, const int[1], false>();
-  test_is_applicable_from_function<void(int) noexcept, const int(&)[1], false>();
+  test_is_applicable_from_function<void(int) noexcept, const int (&)[1], false>();
 
   test_is_applicable<NoExceptCallable<bool>, int[1], false>();
-  test_is_applicable<NoExceptCallable<bool>, int(&)[1], false>();
+  test_is_applicable<NoExceptCallable<bool>, int (&)[1], false>();
   test_is_applicable<NoExceptCallable<bool>, const int[1], false>();
-  test_is_applicable<NoExceptCallable<bool>, const int(&)[1], false>();
+  test_is_applicable<NoExceptCallable<bool>, const int (&)[1], false>();
 }
 
 void test_invalid_invocations() {
diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_applicable.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_applicable.compile.pass.cpp
index f67fe6952..e8be3f090 100644
--- a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_applicable.compile.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_applicable.compile.pass.cpp
@@ -479,18 +479,18 @@ void test_invalid_nontuple_types() {
 
   // test built-in array
   test_is_nothrow_applicable_from_function<void(int), int[1], false>();
-  test_is_nothrow_applicable_from_function<void(int), int(&)[1], false>();
+  test_is_nothrow_applicable_from_function<void(int), int (&)[1], false>();
   test_is_nothrow_applicable_from_function<void(int), const int[1], false>();
-  test_is_nothrow_applicable_from_function<void(int), const int(&)[1], false>();
+  test_is_nothrow_applicable_from_function<void(int), const int (&)[1], false>();
   test_is_nothrow_applicable_from_function<void(int) noexcept, int[1], false>();
-  test_is_nothrow_applicable_from_function<void(int) noexcept, int(&)[1], false>();
+  test_is_nothrow_applicable_from_function<void(int) noexcept, int (&)[1], false>();
   test_is_nothrow_applicable_from_function<void(int) noexcept, const int[1], false>();
-  test_is_nothrow_applicable_from_function<void(int) noexcept, const int(&)[1], false>();
+  test_is_nothrow_applicable_from_function<void(int) noexcept, const int (&)[1], false>();
 
   test_is_nothrow_applicable<NoExceptCallable<bool>, int[1], false>();
-  test_is_nothrow_applicable<NoExceptCallable<bool>, int(&)[1], false>();
+  test_is_nothrow_applicable<NoExceptCallable<bool>, int (&)[1], false>();
   test_is_nothrow_applicable<NoExceptCallable<bool>, const int[1], false>();
-  test_is_nothrow_applicable<NoExceptCallable<bool>, const int(&)[1], false>();
+  test_is_nothrow_applicable<NoExceptCallable<bool>, const int (&)[1], false>();
 }
 
 void test_invalid_invocations() {
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/apply_result.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/apply_result.compile.pass.cpp
index 406579163..21ec35aba 100644
--- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/apply_result.compile.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/apply_result.compile.pass.cpp
@@ -460,18 +460,18 @@ void test_invalid_nontuple_types() {
 
   // test built-in array
   test_invalid_apply_result_from_function<void(int), int[1]>();
-  test_invalid_apply_result_from_function<void(int), int(&)[1]>();
+  test_invalid_apply_result_from_function<void(int), int (&)[1]>();
   test_invalid_apply_result_from_function<void(int), const int[1]>();
-  test_invalid_apply_result_from_function<void(int), const int(&)[1]>();
+  test_invalid_apply_result_from_function<void(int), const int (&)[1]>();
   test_invalid_apply_result_from_function<void(int) noexcept, int[1]>();
-  test_invalid_apply_result_from_function<void(int) noexcept, int(&)[1]>();
+  test_invalid_apply_result_from_function<void(int) noexcept, int (&)[1]>();
   test_invalid_apply_result_from_function<void(int) noexcept, const int[1]>();
-  test_invalid_apply_result_from_function<void(int) noexcept, const int(&)[1]>();
+  test_invalid_apply_result_from_function<void(int) noexcept, const int (&)[1]>();
 
   test_invalid_apply_result<NoExceptCallable<bool>, int[1]>();
-  test_invalid_apply_result<NoExceptCallable<bool>, int(&)[1]>();
+  test_invalid_apply_result<NoExceptCallable<bool>, int (&)[1]>();
   test_invalid_apply_result<NoExceptCallable<bool>, const int[1]>();
-  test_invalid_apply_result<NoExceptCallable<bool>, const int(&)[1]>();
+  test_invalid_apply_result<NoExceptCallable<bool>, const int (&)[1]>();
 }
 
 void test_invalid_invocations() {

``````````

</details>


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


More information about the libcxx-commits mailing list