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.
---
Tested x86_64-linux. Pushed to trunk.
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
--
2.48.1