From d728ebf92b148c6c111c56e9ea7a0ee4ecd3bb9b Mon Sep 17 00:00:00 2001 From: kwy404 Date: Fri, 25 Sep 2026 20:32:29 -0300 Subject: [PATCH] add missing deduction guide for `inplace_stop_callback` [stopcallback.inplace.general] declares a deduction guide so that `inplace_stop_callback cb{token, fn};` deduces the callback type. stdexec did not provide it, so class template argument deduction failed. Add the guide and a test. Fixes #1420 --- include/stdexec/stop_token.hpp | 3 +++ test/stdexec/concepts/test_concepts_stop_tokens.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/stdexec/stop_token.hpp b/include/stdexec/stop_token.hpp index def63b446..960a8b365 100644 --- a/include/stdexec/stop_token.hpp +++ b/include/stdexec/stop_token.hpp @@ -259,6 +259,9 @@ STDEXEC_P2300_NAMESPACE_BEGIN() STDEXEC_ATTRIBUTE(no_unique_address) _Fun __fun_; }; + template + inplace_stop_callback(inplace_stop_token, _Fun) -> inplace_stop_callback<_Fun>; + inline inplace_stop_source::~inplace_stop_source() { STDEXEC_ASSERT((__state_.load(STDEXEC::__std::memory_order_relaxed) & __locked_flag_) == 0); diff --git a/test/stdexec/concepts/test_concepts_stop_tokens.cpp b/test/stdexec/concepts/test_concepts_stop_tokens.cpp index 203b6a7bc..ebf5f6909 100644 --- a/test/stdexec/concepts/test_concepts_stop_tokens.cpp +++ b/test/stdexec/concepts/test_concepts_stop_tokens.cpp @@ -50,4 +50,11 @@ namespace std::stop_callback>); #endif } + + TEST_CASE("inplace_stop_callback supports class template argument deduction", "[stop_token]") + { + ::STDEXEC::inplace_stop_source source; + ::STDEXEC::inplace_stop_callback cb{source.get_token(), on_stop_request{}}; + STATIC_REQUIRE(std::is_same_v>); + } } // namespace