Skip to content

Commit

Permalink
Fix deprecated this capture in folly/experimental/channels/ProxyChann…
Browse files Browse the repository at this point in the history
…el-inl.h

Summary:
In the future LLVM will require that lambdas capture `this` explicitly. `-Wdeprecated-this-capture` checks for and enforces this now.

This diff adds an explicit `this` capture to a lambda to fix an issue that presents similarly to this:
```
   -> fbcode/path/to/my_file.cpp:66:47: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-
Wdeprecated-this-capture]
   ->           detail::createIOWorkerProvider(evb, requestsRegistry_);
   ->                                               ^
   -> fbcode/path/to/my_file.cpp:61:30: note: add an explicit capture of 'this' to capture '*this' by reference
   ->   evb->runInEventBaseThread([=, self_weak = std::move(self_weak)]() {
   ->                              ^
   ->                               , this
```

Reviewed By: meyering

Differential Revision: D52279203

fbshipit-source-id: b897d027b0c238247e0686286325eb555dce8963
  • Loading branch information
r-barnes authored and facebook-github-bot committed Dec 19, 2023
1 parent d90816b commit c5542ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/experimental/channels/ProxyChannel-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ProxyChannelProcessor : public IChannelCallback {
* a value from an input receiver or a cancellation from the output receiver).
*/
void consume(ChannelBridgeBase* bridge) override {
executor_->add([=]() {
executor_->add([=, this]() {
auto state = state_.wlock();
if (bridge == state->sender.get()) {
// The consumer of the output receiver has stopped consuming.
Expand Down

0 comments on commit c5542ed

Please sign in to comment.