Skip to content

Commit c61b226

Browse files
authored
fix(execution): work around MSVC constraint evaluation bug in header mode (#228)
1 parent 3bcdd62 commit c61b226

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/beman/execution/detail/completion_signatures_for.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,25 @@ namespace beman::execution::detail {
3232
struct no_completion_signatures_defined_in_sender {};
3333

3434
/*!
35-
* \brief Primary template declaration for the customization of sender completion signatures.
35+
* \brief Concept to check if an execution tag has a valid get_completion_signatures member template.
36+
* \note Extracted into a concept to work around an MSVC bug that occurs only header builds where
37+
* 'requires' expressions containing dependent types incorrectly evaluate to false when placed
38+
* directly inside a function template body.
3639
* \headerfile beman/execution/execution.hpp <beman/execution/execution.hpp>
3740
* \internal
3841
*/
42+
template <typename Tag, typename Sender, typename... Env>
43+
concept has_valid_complsig_specialization = requires { Tag::template get_completion_signatures<Sender, Env...>(); };
3944

45+
/*!
46+
* \brief Primary template declaration for the customization of sender completion signatures.
47+
* \headerfile beman/execution/execution.hpp <beman/execution/execution.hpp>
48+
* \internal
49+
*/
4050
template <typename Sender, typename... Env>
4151
consteval auto get_completion_signatures_for_helper() {
4252
using tag_t = ::std::remove_cvref_t<::beman::execution::tag_of_t<::std::remove_cvref_t<Sender>>>;
43-
if constexpr (requires { tag_t::template get_completion_signatures<Sender, Env...>(); })
53+
if constexpr (has_valid_complsig_specialization<tag_t, Sender, Env...>)
4454
return tag_t::template get_completion_signatures<Sender, Env...>();
4555
else
4656
return ::beman::execution::detail::no_completion_signatures_defined_in_sender{};

0 commit comments

Comments
 (0)