From 6d03a86a00e7aa05a18e36fa03ad4429f6198db4 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Thu, 19 Nov 2026 03:16:46 +0000 Subject: [PATCH] improve the constraints on the `__completion_signatures_of_t` alias template --- .../__detail/__get_completion_signatures.hpp | 65 +++++++------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/include/stdexec/__detail/__get_completion_signatures.hpp b/include/stdexec/__detail/__get_completion_signatures.hpp index 510894527..e232e53b4 100644 --- a/include/stdexec/__detail/__get_completion_signatures.hpp +++ b/include/stdexec/__detail/__get_completion_signatures.hpp @@ -351,54 +351,37 @@ namespace STDEXEC return STDEXEC::get_completion_signatures<_Sender, _Env...>(); } - ////////////////////////////////////////////////////////////////////////////// - // An minimally constrained alias for the result of get_completion_signatures: -# if STDEXEC_GCC() - STDEXEC_MODULE_EXPORT_AUTHORING - template - requires enable_sender<__decay_t<_Sender>> - && __constant()> - using __completion_signatures_of_t = - decltype(STDEXEC::get_completion_signatures<_Sender, _Env...>()); - -# elif STDEXEC_EDG() - - namespace __detail + namespace __cmplsigs { - template - using __cmplsigs_of_t = - std::integral_constant()), - STDEXEC::get_completion_signatures<_Sender, _Env...>()>::value_type; - } // namespace __detail - - STDEXEC_MODULE_EXPORT_AUTHORING - template - requires enable_sender<__decay_t<_Sender>> - && __minvocable_q<__detail::__cmplsigs_of_t, _Sender, _Env...> - using __completion_signatures_of_t = - decltype(STDEXEC::get_completion_signatures<_Sender, _Env...>()); - -# elif STDEXEC_MSVC() - - // MSVC cannot handle a __completion_signatures_of_t alias template that - // requires get_completion_signatures to be a constant expression, even if we - // wrap the call to get_completion_signatures in an integral_constant like we - // do for EDG. So we skip checking the requirement. - - STDEXEC_MODULE_EXPORT_AUTHORING - template - requires enable_sender<__decay_t<_Sender>> - using __completion_signatures_of_t = - decltype(STDEXEC::get_completion_signatures<_Sender, _Env...>()); + consteval auto __is_constant(auto) noexcept -> bool + { + return true; + } + // The following concept permits get_completion_signatures to return something that + // is not an instance of the completion_signatures class template. + template + concept __constant_completion_signatures = // + enable_sender<__decay_t<_CvSender>> // +# if STDEXEC_GCC() && STDEXEC_GCC_VERSION < 1400 + && __constant()>; # else + && requires { + typename __mbool<__cmplsigs::__is_constant( + STDEXEC::get_completion_signatures<_CvSender, _Env...>())>; + }; +# endif + } // namespace __cmplsigs + ////////////////////////////////////////////////////////////////////////////// + // An minimally constrained alias for the result of get_completion_signatures: + // This alias can be used even if get_completion_signatures does not return an + // instance of the completion_signatures class template. STDEXEC_MODULE_EXPORT_AUTHORING template - requires enable_sender<__decay_t<_Sender>> + requires __cmplsigs::__constant_completion_signatures<_Sender, _Env...> using __completion_signatures_of_t = - __mtypeof()>; -# endif + decltype(STDEXEC::get_completion_signatures<_Sender, _Env...>()); ////////////////////////////////////////////////////////////////////////////// // __get_child_completion_signatures