Skip to content

set_next doesn't detect tag_invoke overloads #631

Description

@glebov-andrey

Hi,

There is an issue with set_next not finding tag_invoke(Receiver &, ...) overloads, while member functions work fine.

Here is a patch which fixes the issue:

diff --git a/include/unifex/receiver_concepts.hpp b/include/unifex/receiver_concepts.hpp
index 8a4af7b..2a415e9 100644
--- a/include/unifex/receiver_concepts.hpp
+++ b/include/unifex/receiver_concepts.hpp
@@ -65,20 +65,20 @@ inline const struct _set_next_fn {
 private:
   template <typename Receiver, typename... Values>
   using set_next_member_result_t =
-      decltype(UNIFEX_DECLVAL(Receiver&).set_next(UNIFEX_DECLVAL(Values)...));
+      decltype(UNIFEX_DECLVAL(Receiver).set_next(UNIFEX_DECLVAL(Values)...));
   template <typename Receiver, typename... Values>
   using _result_t = typename conditional_t<
       tag_invocable<_set_next_fn, Receiver&, Values...>,
       meta_tag_invoke_result<_set_next_fn>,
       meta_quote1_<set_next_member_result_t>>::
-      template apply<Receiver, Values...>;
+      template apply<Receiver&, Values...>;
 
 public:
   template(typename Receiver, typename... Values)                  //
-      (requires tag_invocable<_set_next_fn, Receiver, Values...>)  //
+      (requires tag_invocable<_set_next_fn, Receiver&, Values...>)  //
       auto
       operator()(Receiver& r, Values&&... values) const
-      noexcept(is_nothrow_tag_invocable_v<_set_next_fn, Receiver, Values...>)
+      noexcept(is_nothrow_tag_invocable_v<_set_next_fn, Receiver&, Values...>)
           -> _result_t<Receiver, Values...> {
     return unifex::tag_invoke(_set_next_fn{}, r, (Values &&) values...);
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions