Skip to content

add missing deduction guide for inplace_stop_callback - #2289

Open
kwy404 wants to merge 1 commit into
NVIDIA:mainfrom
kwy404:fix/inplace-stop-callback-ctad
Open

kwy404 wants to merge 1 commit into
NVIDIA:mainfrom
kwy404:fix/inplace-stop-callback-ctad

Conversation

@kwy404

@kwy404 kwy404 commented Sep 25, 2026

Copy link
Copy Markdown

The standard declares a deduction guide for inplace_stop_callback (stopcallback.inplace.general):

template<class CallbackFn>
  inplace_stop_callback(inplace_stop_token, CallbackFn) -> inplace_stop_callback<CallbackFn>;

stdexec did not declare it, so inplace_stop_callback cb{token, fn}; failed to compile. The constructor is a template over its own initializer type, so the implicit guide cannot deduce the callback type (MSVC: "error C2641: cannot deduce template arguments for 'stdexec::inplace_stop_callback'").

This adds the guide right after the class, plus a test in test_concepts_stop_tokens.cpp that checks the deduced type.

Fixes #1420

Tested locally with MSVC 14.44 (Debug): the new test fails to compile without the fix and passes with it, and the rest of test.stdexec passes too (test_any.cpp was left out of the local build because this MSVC version hits an internal compiler error on it, on main as well). clang-format reports no changes on the touched files.

[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 NVIDIA#1420
@copy-pr-bot

copy-pr-bot Bot commented Sep 25, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inplace_stop_callback is missing the template-deduction guide

1 participant