Skip to content

fix undestructible stdexec::__task::__stop_callback_box#1985

Merged
ericniebler merged 1 commit intoNVIDIA:mainfrom
Cra3z:main
Apr 3, 2026
Merged

fix undestructible stdexec::__task::__stop_callback_box#1985
ericniebler merged 1 commit intoNVIDIA:mainfrom
Cra3z:main

Conversation

@Cra3z
Copy link
Copy Markdown
Contributor

@Cra3z Cra3z commented Apr 3, 2026

template <class _StopToken, class _StopSource>
requires __not_same_as<__stop_source_token_t<_StopSource>, _StopToken>
struct __stop_callback_box<_StopToken, _StopSource>
{
using __stop_variant_t = __variant<_StopSource, __stop_source_token_t<_StopSource>>;
using __callback_fn_t = __forward_stop_request<_StopSource>;
using __stop_callback_t = stop_callback_for_t<_StopToken, __callback_fn_t>;
constexpr __stop_callback_box() {}
void __register_callback(auto const & __has_env, __stop_variant_t& __stop)
noexcept(__nothrow_constructible_from<__stop_callback_t, _StopToken, _StopSource&>)
{
std::construct_at(&__cb_, get_stop_token(get_env(__has_env)), __var::__get<0>(__stop));
}
void __reset_callback() noexcept
{
std::destroy_at(&__cb_);
}
union
{
__stop_callback_t __cb_;
};
};

Prior to the adoption of P3074 - trivial union in C++26, if __stop_callback_t has a non-trivial destructor, the destructor of __stop_callback_box is implicitly deleted, which in turn causes the destructor of stdexec::task::__awaiter (which is derived from __stop_callback_box) to be deleted.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 3, 2026

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 0ad2642

@ericniebler ericniebler merged commit 92ec8a2 into NVIDIA:main Apr 3, 2026
51 of 52 checks passed
@ericniebler
Copy link
Copy Markdown
Collaborator

thanks!

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.

2 participants