You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[clang][Sema] Fix false positive -Wshadow with structured binding captures
Previously, lambda init captures that captured structured bindings would
incorrectly emit shadow warnings, even though regular parameter captures
don't emit such warnings. This created inconsistent behavior:
```cpp
void foo1(std::pair<int, int> val) {
[val = val](){}(); // No warning (correct)
}
void foo2(std::pair<int, int> val) {
auto [a, b] = val;
[a = a](){}(); // Warning (incorrect)
}
```
The fix modifies getShadowedDeclaration() for VarDecl to return nullptr
when a lambda init capture would shadow a BindingDecl, ensuring consistent
behavior between regular captures and structured binding captures.
0 commit comments