File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,16 @@ namespace STDEXEC::__sync_wait
118118 template <class _Error >
119119 constexpr void set_error (_Error __err) noexcept
120120 {
121+ # if STDEXEC_NO_STDCPP_EXCEPTIONS()
122+ // sync_wait's only way to deliver an error to its caller is to rethrow
123+ // it. Without exception support, std::make_exception_ptr returns a null
124+ // exception_ptr, which the rethrow path would silently skip -- turning
125+ // an error completion into an empty optional, indistinguishable from a
126+ // stopped completion. Errors must not masquerade as cancellation:
127+ // terminate loudly instead.
128+ (void ) __err;
129+ STDEXEC_TERMINATE ();
130+ # else
121131 if constexpr (__same_as<_Error, std::exception_ptr>)
122132 {
123133 STDEXEC_ASSERT (__err != nullptr ); // std::exception_ptr must not be null.
@@ -132,6 +142,7 @@ namespace STDEXEC::__sync_wait
132142 __state_->__eptr_ = std::make_exception_ptr (static_cast <_Error&&>(__err));
133143 }
134144 __state_->__loop_ .finish ();
145+ # endif
135146 }
136147
137148 constexpr void set_stopped () noexcept
You can’t perform that action at this time.
0 commit comments