Skip to content

Commit e46f8ae

Browse files
committed
fix a bad test for async_scope::spawn_future
the test was relying on a bug in the implementation of `__tuple`, which this commit also fixes. finally, it fixes a bug in the implementation of `starts_on` that causes `terminate` to be called if moving the sender throws.
1 parent 58b7b38 commit e46f8ae

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

include/exec/just_from.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ namespace exec {
5959
template <class... Ts>
6060
requires stdexec::__sigs::__is_compl_sig<_set_tag_t(Ts...)>
6161
auto operator()(Ts&&... ts) const noexcept //
62-
-> stdexec::completion_signatures<_set_tag_t(Ts...)>;
62+
-> stdexec::completion_signatures<_set_tag_t(Ts...)> {
63+
return {};
64+
}
6365
};
6466

6567
template <class Rcvr>

include/stdexec/__detail/__starts_on.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace stdexec {
3737
struct __always {
3838
_Ty __val_;
3939

40-
auto operator()() noexcept -> _Ty {
40+
STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()() noexcept(__nothrow_constructible_from<_Ty, _Ty>) -> _Ty {
4141
return static_cast<_Ty&&>(__val_);
4242
}
4343
};

include/stdexec/__detail/__tuple.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ namespace stdexec {
4646

4747
template <class _Ty>
4848
concept __empty = //
49-
STDEXEC_IS_EMPTY(_Ty) && STDEXEC_IS_TRIVIALLY_CONSTRUCTIBLE(_Ty);
49+
STDEXEC_IS_EMPTY(_Ty) && STDEXEC_IS_TRIVIALLY_CONSTRUCTIBLE(_Ty)
50+
&& STDEXEC_IS_TRIVIALLY_COPYABLE(_Ty);
5051

5152
template <__empty _Ty>
5253
inline _Ty __value{};

test/exec/async_scope/test_spawn_future.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <catch2/catch.hpp>
22
#include <exec/async_scope.hpp>
33
#include <exec/env.hpp>
4+
#include <exec/just_from.hpp>
45
#include <exec/static_thread_pool.hpp>
56
#include "test_common/schedulers.hpp"
67
#include "test_common/receivers.hpp"
@@ -148,7 +149,9 @@ namespace {
148149
};
149150

150151
ex::sender auto snd =
151-
scope.spawn_future(ex::starts_on(pool.get_scheduler(), ex::just(throwing_copy())));
152+
scope.spawn_future(ex::starts_on(pool.get_scheduler(), exec::just_from([](auto sink) {
153+
return sink(throwing_copy());
154+
})));
152155
try {
153156
sync_wait(std::move(snd));
154157
FAIL("Exceptions should have been thrown");

0 commit comments

Comments
 (0)