From 0bfe012a6ebe564dc987677c37de754ec32eb53d Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 31 May 2024 15:28:43 +0300 Subject: [PATCH] sharded: Mark invoke_on_others() helper lambda mutable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise mutable invoke-on-others lambdas fail to compile sharded f; f.invoke_on_others([x] (foo& f) mutable { ... }); generates /home/xemul/src/seastar/include/seastar/core/future.hh:2074:11: error: no type named ‘type’ in ‘struct std::invoke_result&, invoke_on_modifiers::do_run_test_case() const::checker&>’ 2074 | using futurator = futurize>; | ^~~~~~~~~ The invoke_on_all() has its helper lambda mutable so sharded f; f.invoke_on_all([x] (foo& x) mutable { ... }); compiles. Signed-off-by: Pavel Emelyanov --- include/seastar/core/sharded.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/seastar/core/sharded.hh b/include/seastar/core/sharded.hh index 53713ea50ff..36a58811abc 100644 --- a/include/seastar/core/sharded.hh +++ b/include/seastar/core/sharded.hh @@ -780,7 +780,7 @@ sharded::invoke_on_others(smp_submit_to_options options, Func func, Arg static_assert(std::is_same_v>, future<>>, "invoke_on_others()'s func must return void or future<>"); try { - return invoke_on_all(options, [orig = this_shard_id(), func = std::move(func), args = std::tuple(std::move(args)...)] (Service& s) -> future<> { + return invoke_on_all(options, [orig = this_shard_id(), func = std::move(func), args = std::tuple(std::move(args)...)] (Service& s) mutable -> future<> { return this_shard_id() == orig ? make_ready_future<>() : futurize_apply(func, std::tuple_cat(std::forward_as_tuple(s), args));; }); } catch (...) {