From 88da2bbf3f379356765c3fb9a156cc792c4a8c85 Mon Sep 17 00:00:00 2001 From: Jeff Palm Date: Fri, 23 Feb 2024 08:54:21 -0800 Subject: [PATCH] fix -Wshadow issue Summary: -Wshadow triggered in LLVM-17: ``` fbcode/folly/futures/ThreadWheelTimekeeper.cpp:61:42: error: declaration shadows a structured binding [-Werror,-Wshadow] 61 | eventBase_.runInEventBaseThread([this, cob = std::move(cob), dur] { | ^ fbcode/folly/futures/ThreadWheelTimekeeper.cpp:47:9: note: previous declaration is here 47 | auto [cob, sf] = WTCallback::create(&eventBase_); | ^ ``` This seems to only be triggered in llvm-17, llvm-15 doesn't pick it up: ``` $ buck2 build -c cxx.extra_cxxflags=-Wshadow folly/futures:core ... BUILD SUCCEEDE ``` Differential Revision: D54112254 --- .../folly/src/folly/futures/ThreadWheelTimekeeper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/third-party/folly/src/folly/futures/ThreadWheelTimekeeper.cpp b/third-party/folly/src/folly/futures/ThreadWheelTimekeeper.cpp index 0e0df0979e782..3056766c254f1 100644 --- a/third-party/folly/src/folly/futures/ThreadWheelTimekeeper.cpp +++ b/third-party/folly/src/folly/futures/ThreadWheelTimekeeper.cpp @@ -58,8 +58,9 @@ SemiFuture ThreadWheelTimekeeper::after(HighResDuration dur) { // canceling timeout is executed in EventBase thread, the actual timeout // callback has either been executed, or will never be executed. So we are // fine here. - eventBase_.runInEventBaseThread([this, cob = std::move(cob), dur] { - wheelTimer_->scheduleTimeout(cob.get(), folly::chrono::ceil(dur)); + eventBase_.runInEventBaseThread([this, cob2 = std::move(cob), dur] { + wheelTimer_->scheduleTimeout( + cob2.get(), folly::chrono::ceil(dur)); }); return std::move(sf); }