[clang] [clang][Sema] Fix false-positive -Wshadow for friend functions (PR #221249)

Bruno De Fraine via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 03:24:14 PDT 2026


brunodf-gf wrote:

Careful, I think this fix drops some true-positive -Wshadow warnings as well. Consider this:

```
struct Foo {
  int a;
  int x = [this] {
    int a = 0;            // shadows Foo::a
    return a;
  }();
};
```

Currently we give a warning about this: https://godbolt.org/z/9xsedberW
When I test this PR, the warning is gone.

https://github.com/llvm/llvm-project/pull/221249


More information about the cfe-commits mailing list