From 242a83b6d8006f8d10bcb7f018e0f09549d41b57 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Jun 2024 16:19:08 -0700 Subject: [PATCH] [gcc-7] Fix for dump-args (#36824) Closes #36824 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36824 from ctiller:old-gcc 3b58efe98e5dcd75e4b5c03bb3dfec10bef4a28c PiperOrigin-RevId: 640684291 --- src/core/lib/gprpp/dump_args.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/lib/gprpp/dump_args.h b/src/core/lib/gprpp/dump_args.h index c2b66ce2be3..abd5b6a2027 100644 --- a/src/core/lib/gprpp/dump_args.h +++ b/src/core/lib/gprpp/dump_args.h @@ -36,15 +36,15 @@ class DumpArgs { template explicit DumpArgs(const char* arg_string, const Args&... args) : arg_string_(arg_string) { - do_these_things( - {AddDumper([a = &args](std::ostream& os) { os << *a; })...}); + do_these_things({AddDumper(&args)...}); } friend std::ostream& operator<<(std::ostream& out, const DumpArgs& args); private: - int AddDumper(absl::AnyInvocable dumper) { - arg_dumpers_.push_back(std::move(dumper)); + template + int AddDumper(T* p) { + arg_dumpers_.push_back([p](std::ostream& os) { os << *p; }); return 0; } @@ -66,4 +66,4 @@ class DumpArgs { #define GRPC_DUMP_ARGS(...) \ grpc_core::dump_args_detail::DumpArgs(#__VA_ARGS__, __VA_ARGS__) -#endif // GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H +#endif // GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H \ No newline at end of file