@@ -62,11 +62,6 @@ namespace STDEXEC {
6262 constexpr auto query (__root_t ) const noexcept -> bool {
6363 return true ;
6464 }
65-
66- // static constexpr auto query(__debug::__is_debug_env_t) noexcept -> bool
67- // {
68- // return true;
69- // }
7065 };
7166
7267 // What should sync_wait(just_stopped()) return?
@@ -99,8 +94,8 @@ namespace STDEXEC {
9994 std::optional<std::tuple<_Values...>>* __values_;
10095
10196 template <class ... _As>
102- requires __std::constructible_from<std::tuple<_Values...>, _As...>
10397 void set_value (_As&&... __as) noexcept {
98+ static_assert (__std::constructible_from<std::tuple<_Values...>, _As...>);
10499 STDEXEC_TRY {
105100 __values_->emplace (static_cast <_As&&>(__as)...);
106101 }
@@ -192,60 +187,61 @@ namespace STDEXEC {
192187 // //////////////////////////////////////////////////////////////////////////
193188 // [execution.senders.consumers.sync_wait]
194189 struct sync_wait_t {
195- template <class _Sender >
190+ template <sender_in<__env> _Sender>
196191 auto operator ()(_Sender&& __sndr) const {
197- if constexpr (!sender_in<_Sender, __env>) {
198- STDEXEC::__diagnose_sender_concept_failure<_Sender, __env>();
199- } else {
200- using __domain_t = __completion_domain_of_t <set_value_t , _Sender, __env>;
201- constexpr auto __success_completion_count =
202- __count_of<set_value_t , _Sender, __env>::value;
203-
204- static_assert (
205- __success_completion_count != 0 ,
206- " The argument to STDEXEC::sync_wait() is a sender that cannot complete successfully. "
207- " STDEXEC::sync_wait() requires a sender that can complete successfully in exactly one "
208- " way. In other words, the sender's completion signatures must include exactly one "
209- " signature of the form `set_value_t(value-types...)`." );
210-
211- static_assert (
212- __success_completion_count <= 1 ,
213- " The sender passed to STDEXEC::sync_wait() can complete successfully in "
214- " more than one way. Use STDEXEC::sync_wait_with_variant() instead." );
215-
216- if constexpr (1 == __success_completion_count) {
217- using __sync_wait_receiver = __receiver_t <_Sender>;
218- constexpr bool __no_custom_sync_wait = __same_as<__domain_t , default_domain>;
219- if constexpr (__no_custom_sync_wait && sender_to<_Sender, __sync_wait_receiver>) {
220- // using __connect_result = connect_result_t<_Sender, __sync_wait_receiver>;
221- // if constexpr (!operation_state<__connect_result>) {
222- // static_assert(
223- // operation_state<__connect_result>,
224- // "The `connect` member function of the sender passed to STDEXEC::sync_wait() does "
225- // "not return an operation state. An operation state is required to have a "
226- // "no-throw .start() member function.");
227- // } else
228- {
192+ using __domain_t = __completion_domain_of_t <set_value_t , _Sender, __env>;
193+ constexpr auto __success_completion_count = __count_of<set_value_t , _Sender, __env>::value;
194+
195+ static_assert (
196+ __success_completion_count != 0 ,
197+ " The argument to STDEXEC::sync_wait() is a sender that cannot complete successfully. "
198+ " STDEXEC::sync_wait() requires a sender that can complete successfully in exactly one "
199+ " way. In other words, the sender's completion signatures must include exactly one "
200+ " signature of the form `set_value_t(value-types...)`." );
201+
202+ static_assert (
203+ __success_completion_count <= 1 ,
204+ " The sender passed to STDEXEC::sync_wait() can complete successfully in "
205+ " more than one way. Use STDEXEC::sync_wait_with_variant() instead." );
206+
207+ if constexpr (1 == __success_completion_count) {
208+ if constexpr (__same_as<__domain_t , default_domain>) {
209+ if constexpr (sender_to<_Sender, __receiver_t <_Sender>>) {
210+ using __opstate_t = connect_result_t <_Sender, __receiver_t <_Sender>>;
211+ if constexpr (operation_state<__opstate_t >) {
229212 // success path, dispatch to the default domain's sync_wait
230213 return default_domain ().apply_sender (*this , static_cast <_Sender&&>(__sndr));
214+ } else {
215+ static_assert (
216+ operation_state<__opstate_t >,
217+ " The `connect` member function of the sender passed to STDEXEC::sync_wait() "
218+ " does not return an operation state. An operation state is required to have a "
219+ " no-throw .start() member function." );
231220 }
232- } else if constexpr (__no_custom_sync_wait) {
221+ } else {
233222 static_assert (
234- sender_to<_Sender, __sync_wait_receiver >,
223+ sender_to<_Sender, __receiver_t <_Sender> >,
235224 STDEXEC_ERROR_SYNC_WAIT_CANNOT_CONNECT_SENDER_TO_RECEIVER);
236- } else if constexpr (!__has_implementation_for<sync_wait_t , __domain_t , _Sender>) {
237- static_assert (
238- __has_implementation_for<sync_wait_t , __domain_t , _Sender>,
239- " The sender passed to STDEXEC::sync_wait() has a domain that does not provide a "
240- " usable implementation for sync_wait()." );
241- } else {
242- // success path, dispatch to the custom domain's sync_wait
243- return STDEXEC::apply_sender (__domain_t (), *this , static_cast <_Sender&&>(__sndr));
244225 }
226+ } else if constexpr (!__has_implementation_for<sync_wait_t , __domain_t , _Sender>) {
227+ static_assert (
228+ __has_implementation_for<sync_wait_t , __domain_t , _Sender>,
229+ " The sender passed to STDEXEC::sync_wait() has a domain that does not provide a "
230+ " usable implementation for sync_wait()." );
231+ } else {
232+ // success path, dispatch to the custom domain's sync_wait
233+ return STDEXEC::apply_sender (__domain_t (), *this , static_cast <_Sender&&>(__sndr));
245234 }
246235 }
247236 }
248237
238+ template <class _Sender >
239+ auto operator ()(_Sender&&) const {
240+ STDEXEC::__diagnose_sender_concept_failure<_Sender, __env>();
241+ // dummy return type to silence follow-on errors
242+ return std::optional<std::tuple<int >>{};
243+ }
244+
249245 // clang-format off
250246 // / @brief Synchronously wait for the result of a sender, blocking the
251247 // / current thread.
0 commit comments