Skip to content

Commit 2979af5

Browse files
authored
Merge pull request #1712 from RobertLeahy/let_value_invocation_noexcept_20251213
let_value, _error, & _stopped: Check Invocation Noexceptness With Cor…
2 parents fbb47a2 + ef03f7b commit 2979af5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

include/stdexec/__detail/__let.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ namespace stdexec {
604604
_Receiver& __rcvr = __op_state.__rcvr_;
605605

606606
if constexpr (
607-
(__nothrow_decay_copyable<_As> && ...) && __nothrow_callable<_Fun, _As...>
607+
(__nothrow_decay_copyable<_As> && ...) && __nothrow_callable<_Fun, __decay_t<_As>&...>
608608
&& __nothrow_connectable<_ResultSender, __result_receiver_t<_Receiver, _Env2>>) {
609609
__bind_(__state, __op_state, static_cast<_As&&>(__as)...);
610610
} else {

test/stdexec/algos/adaptors/test_let_value.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,18 @@ namespace {
130130
}
131131

132132
TEST_CASE("let_value can throw, and set_error will be called", "[adaptors][let_value]") {
133-
auto snd = ex::just(13)
134-
| ex::let_value([](int&) -> decltype(ex::just(0)) { throw std::logic_error{"err"}; });
133+
struct invocable {
134+
decltype(ex::just(0)) operator()(int&) && {
135+
throw std::logic_error{"err"};
136+
}
137+
decltype(ex::just()) operator()(int&&) && noexcept;
138+
};
139+
auto snd = ex::just(13) | ex::let_value(invocable{});
140+
static_assert(set_equivalent<
141+
::stdexec::completion_signatures<
142+
::stdexec::set_value_t(int),
143+
::stdexec::set_error_t(std::exception_ptr)>,
144+
::stdexec::completion_signatures_of_t<decltype(snd), ::stdexec::env<>>>);
135145
auto op = ex::connect(std::move(snd), expect_error_receiver{});
136146
ex::start(op);
137147
}

0 commit comments

Comments
 (0)