Skip to content

Commit 086182c

Browse files
ccotterericniebler
andauthored
Instantiate the debug sender inside connect() (#1070)
--------- Co-authored-by: Eric Niebler <[email protected]>
1 parent 14bb904 commit 086182c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

include/stdexec/execution.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,22 @@ namespace stdexec {
20062006
__callable<__connect_awaitable_t, __tfx_sender<_Sender, _Receiver>, _Receiver>;
20072007

20082008
struct connect_t {
2009+
2010+
template <class _Sender, class _Env>
2011+
static constexpr bool __check_signatures() {
2012+
if constexpr (sender_in<_Sender, _Env>) {
2013+
// Instantiate __debug_sender via completion_signatures_of_t
2014+
// to check that the actual completions match the expected
2015+
// completions.
2016+
//
2017+
// Instantiate completion_signatures_of_t only if sender_in
2018+
// is true to workaround Clang not implementing CWG#2369 yet (connect()
2019+
// does have a constraint for _Sender satisfying sender_in).
2020+
using __checked_signatures [[maybe_unused]] = completion_signatures_of_t<_Sender, _Env>;
2021+
}
2022+
return true;
2023+
}
2024+
20092025
template <class _Sender, class _Receiver>
20102026
static constexpr auto __select_impl() noexcept {
20112027
// Report that 2300R5-style senders and receivers are deprecated:
@@ -2015,6 +2031,8 @@ namespace stdexec {
20152031
if constexpr (!enable_receiver<__decay_t<_Receiver>>)
20162032
_PLEASE_UPDATE_YOUR_RECEIVER_TYPE< __decay_t<_Receiver>>();
20172033

2034+
static_assert(__check_signatures<_Sender, env_of_t<_Receiver>>());
2035+
20182036
using _Domain = __env_domain_of_t<env_of_t<_Receiver&>>;
20192037
constexpr bool _NothrowTfxSender =
20202038
__nothrow_callable<get_env_t, _Receiver&>
@@ -4341,7 +4359,7 @@ namespace stdexec {
43414359
__cvref_t<_CvrefSenderId>,
43424360
__env_t<__t<_EnvId>>,
43434361
completion_signatures<
4344-
set_error_t(const std::exception_ptr&),
4362+
set_error_t(std::exception_ptr&&),
43454363
set_stopped_t()>, // NOT TO SPEC
43464364
__q<__set_value_t>,
43474365
__q<__set_error_t>>;

0 commit comments

Comments
 (0)