[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 18:37:30 PST 2023
fsb4000 updated this revision to Diff 500035.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144645/new/
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,25 @@
}
}
+// LWG-3655: The INVOKE operation and union types
+union Union {
+ int x;
+};
+static_assert(std::is_invocable_v<int Union::*, Union>);
+static_assert(std::is_invocable_v<int Union::*, Union&>);
+static_assert(std::is_invocable_v<int Union::*, const Union>);
+static_assert(std::is_invocable_v<int Union::*, const Union&>);
+
+static_assert(std::is_invocable_v<void (Union::*)(), Union>);
+static_assert(std::is_invocable_v<void (Union::*)(), Union&>);
+static_assert(std::!is_invocable_v<void (Union::*)(), const Union>);
+static_assert(std::!is_invocable_v<void (Union::*)(), const Union&>);
+
+static_assert(std::is_invocable_v<void (Union::*)() const, Union>);
+static_assert(std::is_invocable_v<void (Union::*)() const, Union&>);
+static_assert(std::is_invocable_v<void (Union::*)() const, const Union>);
+static_assert(std::is_invocable_v<void (Union::*)() const, const Union&>);
+
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.500035.patch
Type: text/x-patch
Size: 4082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230224/721a2f1a/attachment-0001.bin>
More information about the libcxx-commits
mailing list