From 1f6d28b343ee290de5d47ee7a0711e85f6b738a2 Mon Sep 17 00:00:00 2001 From: Ian Petersen Date: Wed, 6 May 2026 16:52:15 -0700 Subject: [PATCH] Make repeat_n support dependent senders --- include/exec/repeat_n.hpp | 12 ++++++++++-- test/exec/test_repeat_n.cpp | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/exec/repeat_n.hpp b/include/exec/repeat_n.hpp index 9c2c75904..58344d868 100644 --- a/include/exec/repeat_n.hpp +++ b/include/exec/repeat_n.hpp @@ -225,11 +225,19 @@ namespace experimental::execution return {STDEXEC::schedule(trampoline_scheduler{}), const_cast<_Child &>(__child)}; }; - template + template + requires(!STDEXEC::dependent_sender<__child_of<_Sender>>) static consteval auto __get_completion_signatures() { // TODO: port this to use constant evaluation - return __completions_t<__child_of<_Sender>, _Env...>{}; + return __completions_t<__child_of<_Sender>>{}; + } + + template + static consteval auto __get_completion_signatures() + { + // TODO: port this to use constant evaluation + return __completions_t<__child_of<_Sender>, _Env>{}; } static constexpr auto __connect = // diff --git a/test/exec/test_repeat_n.cpp b/test/exec/test_repeat_n.cpp index 03b8e4601..76862c971 100644 --- a/test/exec/test_repeat_n.cpp +++ b/test/exec/test_repeat_n.cpp @@ -199,4 +199,9 @@ namespace } } + TEST_CASE("repeat_n forwards the environment", "[adaptors][repeat_n]") + { + ex::sync_wait( + exec::repeat_n(ex::then(ex::read_env(ex::get_start_scheduler), [](auto) noexcept {}), 1)); + } } // namespace