[libcxx-commits] [PATCH] D116293: [libc++] [test] Remove IFNDR uses of std::invocable.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 26 18:40:56 PST 2021


Quuxplusone created this revision.
Quuxplusone added reviewers: jwakely, ldionne, Mordante, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

libstdc++'s implementation diagnoses these with hard errors: `std::invocable<Ts...>` is IFNDR whenever `std::is_invocable<Ts...>` is IFNDR, which happens whenever any of the `Ts...` are //not// "complete types, cv void, or arrays of unknown bound." In particular, arrays of known bound of incomplete element types are bad — but //references// to such arrays are perfectly fine, so that's the fix here.

Fixes https://github.com/llvm/llvm-project/issues/50059


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116293

Files:
  libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
  libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
  libcxx/test/std/ranges/range.access/data.pass.cpp


Index: libcxx/test/std/ranges/range.access/data.pass.cpp
===================================================================
--- libcxx/test/std/ranges/range.access/data.pass.cpp
+++ libcxx/test/std/ranges/range.access/data.pass.cpp
@@ -25,8 +25,8 @@
 struct Incomplete;
 
 static_assert(!std::is_invocable_v<RangeDataT, Incomplete[]>);
-static_assert(!std::is_invocable_v<RangeDataT, Incomplete[2]>);
-static_assert(!std::is_invocable_v<RangeDataT, Incomplete[2][2]>);
+static_assert(!std::is_invocable_v<RangeDataT, Incomplete(&&)[2]>);
+static_assert(!std::is_invocable_v<RangeDataT, Incomplete(&&)[2][2]>);
 static_assert(!std::is_invocable_v<RangeDataT, int [1]>);
 static_assert(!std::is_invocable_v<RangeDataT, int (&&)[1]>);
 static_assert( std::is_invocable_v<RangeDataT, int (&)[1]>);
Index: libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
===================================================================
--- libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
+++ libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
@@ -263,11 +263,10 @@
 } // namespace function_objects
 
 namespace pointer_to_member_functions {
-// clang-format off
   template<class Member, class T, class... Args>
   constexpr bool check_member_is_invocable()
   {
-    constexpr bool result = std::regular_invocable<Member, T, Args...>;
+    constexpr bool result = std::regular_invocable<Member, T&&, Args...>;
     using uncv_t = std::remove_cvref_t<T>;
     static_assert(std::regular_invocable<Member, uncv_t*, Args...> == result);
     static_assert(std::regular_invocable<Member, std::unique_ptr<uncv_t>, Args...> == result);
@@ -280,7 +279,6 @@
     static_assert(!std::regular_invocable<Member, S2*, Args...>);
     return result;
   }
-// clang-format on
 
 static_assert(check_member_is_invocable<int S::*, S>());
 static_assert(std::regular_invocable<int S::*, S&>);
Index: libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
===================================================================
--- libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
+++ libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
@@ -237,11 +237,10 @@
 } // namespace function_objects
 
 namespace pointer_to_member_functions {
-// clang-format off
   template<class Member, class T, class... Args>
   constexpr bool check_member_is_invocable()
   {
-    constexpr bool result = std::invocable<Member, T, Args...>;
+    constexpr bool result = std::invocable<Member, T&&, Args...>;
     using uncv_t = std::remove_cvref_t<T>;
     static_assert(std::invocable<Member, uncv_t*, Args...> == result);
     static_assert(std::invocable<Member, std::unique_ptr<uncv_t>, Args...> == result);
@@ -254,7 +253,6 @@
     static_assert(!std::invocable<Member, S2*, Args...>);
     return result;
   }
-// clang-format on
 
 static_assert(check_member_is_invocable<int S::*, S>());
 static_assert(std::invocable<int S::*, S&>);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116293.396253.patch
Type: text/x-patch
Size: 3154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211227/b3edbcde/attachment-0001.bin>


More information about the libcxx-commits mailing list