Skip to content

add missing deduction guide for inplace_stop_callback - #2289

Merged
ericniebler merged 1 commit into
NVIDIA:mainfrom
kwy404:fix/inplace-stop-callback-ctad
Sep 28, 2026
Merged

ericniebler merged 1 commit into
NVIDIA:mainfrom
kwy404:fix/inplace-stop-callback-ctad

Conversation

@kwy404

@kwy404 kwy404 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

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.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test d728ebf

@ericniebler
ericniebler merged commit 72cde59 into NVIDIA:main Sep 28, 2026
39 checks passed
@ericniebler

Copy link
Copy Markdown
Collaborator

thanks! and welcome to the project @kwy404

kwy404 added a commit to kwy404/kwy404 that referenced this pull request Sep 28, 2026
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

2 participants