Skip to content

Commit fd56a25

Browse files
committed
make exec::variant_sender conditionally non-dependent
fixes #1843
1 parent 8e35452 commit fd56a25

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

include/exec/variant_sender.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ namespace exec {
5151

5252
template <class... _Senders>
5353
struct variant_sender {
54-
template <class _Self, class _Env>
54+
template <class _Self, class... _Env>
5555
using __completions_t = STDEXEC::__mtry_q<STDEXEC::__concat_completion_signatures_t>::__f<
56-
STDEXEC::__completion_signatures_of_t<STDEXEC::__copy_cvref_t<_Self, _Senders>, _Env>...
56+
STDEXEC::__completion_signatures_of_t<STDEXEC::__copy_cvref_t<_Self, _Senders>, _Env...>...
5757
>;
5858

5959
template <std::size_t _Index>
@@ -125,8 +125,8 @@ namespace exec {
125125
}
126126
STDEXEC_EXPLICIT_THIS_END(connect)
127127

128-
template <STDEXEC::__decays_to<variant_sender> _Self, class _Env>
129-
static consteval auto get_completion_signatures() -> __completions_t<_Self, _Env> {
128+
template <STDEXEC::__decays_to<variant_sender> _Self, class... _Env>
129+
static consteval auto get_completion_signatures() -> __completions_t<_Self, _Env...> {
130130
return {};
131131
}
132132
};

test/exec/test_variant_sender.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@ namespace {
3333

3434
using just_int_t = decltype(just(0));
3535
using just_void_t = decltype(just());
36+
using just_then_void_t = decltype(then(just(), [] { }));
3637

3738
TEST_CASE("variant_sender - default constructible", "[types][variant_sender]") {
3839
variant_sender<just_void_t, just_int_t> variant{just()};
40+
STATIC_REQUIRE(sender_in<decltype(variant)>);
3941
CHECK(variant.index() == 0);
4042
}
4143

44+
TEST_CASE("variant_sender - sender_of concept", "[types][variant_sender]") {
45+
variant_sender<just_void_t, just_then_void_t> variant{just()};
46+
STATIC_REQUIRE(sender_of<decltype(variant), set_value_t()>);
47+
}
48+
4249
TEST_CASE("variant_sender - using an overloaded then adaptor", "[types][variant_sender]") {
4350
variant_sender<just_void_t, just_int_t> variant = just();
4451
int index = -1;

0 commit comments

Comments
 (0)