facebookexperimental / facebookexperimental/libunifex

`set_next` doesn't detect `tag_invoke` overloads

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

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
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
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
using _result_t = typename conditional_t<
tag_invocable<_set_next_fn, Receiver&, Values...>,
meta_tag_invoke_result<_set_next_fn>,
meta_quote1_>::
- template apply;
+ template apply;

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 {
return unifex::tag_invoke(_set_next_fn{}, r, (Values &&) values...);
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.