On clang-18.1.7, static analyzer warns about method parameter shadowing of a class field that has the same name member variable.
Example:
struct Foo {
int val;
void bar(this auto &self, int val) {
self.val = val;
}
};
Error message:
// $ clang++ [...] -std=c++23 -O3 -Wshadow
<source>:6:36: warning: declaration shadows a field of 'Foo' [-Wshadow]
6 | void bar(this auto &self, int val) {
| ^
<source>:4:9: note: previous declaration is here
4 | int val;
| ^
1 warning generated.