diff --git a/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp b/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp index b48de1647..52439a991 100644 --- a/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp +++ b/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp @@ -65,7 +65,7 @@ namespace pika::mpi::experimental { if (completions_inline) { - auto f_completion = [=, f = std::forward(f)](auto&... args) mutable { + auto f_completion = [mode, p, f = std::forward(f)](auto&... args) mutable { return just(std::forward_as_tuple(args...)) | unpack() | dispatch_mpi(std::move(f)) | trigger_mpi(mode); }; @@ -82,7 +82,7 @@ namespace pika::mpi::experimental { } else { - auto f_completion = [=, f = std::forward(f)](auto&... args) mutable { + auto f_completion = [mode, p, f = std::forward(f)](auto&... args) mutable { return just(std::forward_as_tuple(args...)) | unpack() | dispatch_mpi(std::move(f)) | trigger_mpi(mode) | continues_on(default_pool_scheduler(p));