[libcxx-commits] [PATCH] D144645: [libc++] Implement LWG-3655: The INVOKE operation and union types.

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 23 07:31:20 PST 2023


fsb4000 created this revision.
fsb4000 added a reviewer: libc++.
fsb4000 added a project: libc++.
Herald added a project: All.
fsb4000 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

https://cplusplus.github.io/LWG/issue3655


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144645

Files:
  libcxx/docs/Status/Cxx2bIssues.csv
  libcxx/include/__functional/invoke.h
  libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp


Index: libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
===================================================================
--- libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
+++ libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
@@ -346,6 +346,13 @@
     }
 }
 
+// LWG-3655: The INVOKE operation and union types
+union Foo {
+    int x;
+};
+static_assert(std::is_invocable_v<int Foo::*, Foo&>);
+static_assert(std::is_invocable_v<void (Foo::*)(), Foo&>);
+
 int main(int, char**) {
     bullet_one_two_tests();
     bullet_three_four_tests();
Index: libcxx/include/__functional/invoke.h
===================================================================
--- libcxx/include/__functional/invoke.h
+++ libcxx/include/__functional/invoke.h
@@ -272,7 +272,7 @@
 using __enable_if_bullet1 = typename enable_if
     <
         is_member_function_pointer<_DecayFp>::value
-        && is_base_of<_ClassT, _DecayA0>::value
+        && (is_same<_ClassT, _DecayA0>::value || is_base_of<_ClassT, _DecayA0>::value)
     >::type;
 
 template <class _Fp, class _A0,
@@ -291,7 +291,7 @@
 using __enable_if_bullet3 = typename enable_if
     <
         is_member_function_pointer<_DecayFp>::value
-        && !is_base_of<_ClassT, _DecayA0>::value
+        && !(is_same<_ClassT, _DecayA0>::value || is_base_of<_ClassT, _DecayA0>::value)
         && !__is_reference_wrapper<_DecayA0>::value
     >::type;
 
@@ -302,7 +302,7 @@
 using __enable_if_bullet4 = typename enable_if
     <
         is_member_object_pointer<_DecayFp>::value
-        && is_base_of<_ClassT, _DecayA0>::value
+        && (is_same<_ClassT, _DecayA0>::value || is_base_of<_ClassT, _DecayA0>::value)
     >::type;
 
 template <class _Fp, class _A0,
@@ -321,7 +321,7 @@
 using __enable_if_bullet6 = typename enable_if
     <
         is_member_object_pointer<_DecayFp>::value
-        && !is_base_of<_ClassT, _DecayA0>::value
+        && !(is_same<_ClassT, _DecayA0>::value || is_base_of<_ClassT, _DecayA0>::value)
         && !__is_reference_wrapper<_DecayA0>::value
     >::type;
 
Index: libcxx/docs/Status/Cxx2bIssues.csv
===================================================================
--- libcxx/docs/Status/Cxx2bIssues.csv
+++ libcxx/docs/Status/Cxx2bIssues.csv
@@ -280,7 +280,7 @@
 "`3622 <https://wg21.link/LWG3622>`__","Misspecified transitivity of equivalence in ยง[unord.req.general]","February 2023","","",""
 "`3631 <https://wg21.link/LWG3631>`__","``basic_format_arg(T&&)`` should use ``remove_cvref_t<T>`` throughout","February 2023","|Complete|","15.0",""
 "`3645 <https://wg21.link/LWG3645>`__","``resize_and_overwrite`` is overspecified to call its callback with lvalues","February 2023","|Complete|","14.0",""
-"`3655 <https://wg21.link/LWG3655>`__","The ``INVOKE`` operation and union types","February 2023","","",""
+"`3655 <https://wg21.link/LWG3655>`__","The ``INVOKE`` operation and union types","February 2023","|Complete|","17.0",""
 "`3723 <https://wg21.link/LWG3723>`__","``priority_queue::push_range`` needs to ``append_range``","February 2023","","","|ranges|"
 "`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","","",""
 "`3772 <https://wg21.link/LWG3772>`__","``repeat_view``'s ``piecewise`` constructor is missing Postconditions","February 2023","","","|ranges|"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144645.499852.patch
Type: text/x-patch
Size: 3387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230223/93eed1c7/attachment.bin>


More information about the libcxx-commits mailing list