https://gcc.gnu.org/g:e9ed0a05fddaba4e5257beaddb7cbaf31607a784

commit r15-7555-ge9ed0a05fddaba4e5257beaddb7cbaf31607a784
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Feb 13 00:26:27 2025 +0000

    libstdc++: Simplify and comment std::jthread extension [PR100612]
    
    Use a requires-clause on the partial specialization of the
    __pmf_expects_stop_token variable template, which is used for the
    extension that allows constructing std::jthread with a
    pointer-to-member-function that accepts a std::stop_token argument.
    
    Also add a comment referring to the related Bugzilla PR.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/100612
            * include/std/thread (__pmf_expects_stop_token): Constrain
            variable template specialization with concept. Add comment.

Diff:
---
 libstdc++-v3/include/std/thread | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 7ded2a7aea43..d2f91ad89953 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -123,13 +123,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @cond undocumented
 #ifndef __STRICT_ANSI__
+    // As an extension we support invoking a pointer-to-member-function that
+    // expects a stop_token as the first argument. See PR libstdc++/100612.
     template<typename _Callable, typename... _Args>
       constexpr bool __pmf_expects_stop_token = false;
 
     template<typename _Callable, typename _Obj, typename... _Args>
+      requires is_member_function_pointer_v<remove_reference_t<_Callable>>
       constexpr bool __pmf_expects_stop_token<_Callable, _Obj, _Args...>
-       = __and_<is_member_function_pointer<remove_reference_t<_Callable>>,
-                is_invocable<_Callable, _Obj, stop_token, _Args...>>::value;
+       = is_invocable_v<_Callable, _Obj, stop_token, _Args...>;
 #endif
     /// @endcond

Reply via email to