Skip to content

Commit 2c57ccd

Browse files
authored
Merge pull request NVIDIA#1983 from Cra3z/main
Fix use-after-move in `stdexec::spawn`
2 parents 4b4182e + 8f64706 commit 2c57ccd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/stdexec/__detail/__spawn.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ namespace STDEXEC
135135
auto __wrapped_sender = __tkn.wrap(static_cast<_Sender&&>(__sndr));
136136
auto __sndr_env = get_env(__wrapped_sender);
137137

138-
using __raw_alloc = decltype(__spawn_common::__choose_alloc(__env, __sndr_env));
138+
auto __raw_alloc = __spawn_common::__choose_alloc(__env, __sndr_env);
139+
using __raw_alloc_t = decltype(__raw_alloc);
139140

140141
auto __sender_with_env = write_env(std::move(__wrapped_sender),
141142
__spawn_common::__choose_senv(__env, __sndr_env));
142143

143144
using __spawn_state_t =
144-
__spawn_state<__raw_alloc, std::remove_cvref_t<_Token>, decltype(__sender_with_env)>;
145+
__spawn_state<__raw_alloc_t, std::remove_cvref_t<_Token>, decltype(__sender_with_env)>;
145146

146147
using __traits =
147-
std::allocator_traits<__raw_alloc>::template rebind_traits<__spawn_state_t>;
148-
typename __traits::allocator_type __alloc(
149-
__spawn_common::__choose_alloc(__env, __sndr_env));
148+
std::allocator_traits<__raw_alloc_t>::template rebind_traits<__spawn_state_t>;
149+
typename __traits::allocator_type __alloc(__raw_alloc);
150150

151151
auto* __op = __traits::allocate(__alloc, 1);
152152

0 commit comments

Comments
 (0)