<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95707>95707</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[static-analyzer] False positive warning with `-Wshadow` on parameter names using `Deducing This`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
exdal
</td>
</tr>
</table>
<pre>
On `clang-18.1.7`, static analyzer warns about method parameter shadowing of a class field that has the same name member variable.
Example:
```cpp
struct Foo {
int val;
void bar(this auto &self, int val) {
self.val = val;
}
};
```
Error message:
```cpp
// $ 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.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE2PpDYQ_TXVl1IjsAEPBw7dw_R1L5FyLqAARwa3bNOzm18fGfpjZ5Uo0lrIWP545ffqlcl7PS7MNRRnKJoDrWGyrubvPZlDa_sf9bcFoUw7Q8t4zN6SLFFQpiDe0QcKukNayPz4mx1-kls8UmvXgDOHyfZ4JUczB3boJ-rtp15GtAMSdoa8x0Gz6TFMFHAij2Fi9DQzLrGbeW7Z4Y2cptZwAmkD6WnvP77TfDUM8oT36TLdv-563Wd8cGsX8GItgjrvc4iIegl4IwPy_DMg3qzusSUH4i1M2iOtwSKI0rMZItnHMVF9hYst7kluZBBk8wUbQTX3KKp5RXzc9Qsj56zDmb2nMfL6L1ogLiAuCCLHLSUgziDOCMU5SRIoGjz60INsun1BSDx-k3j8c9f_jiHfvV1dxyA_QJ5KkCcZuy2DehnjsOfOkKOg7XLPnUe6J8wOCEJdrAWhYuQnetG8hCkR1Psmz-9L-0D4nwbFx78Sy0GeqkhmsWHzytXxTdvVf2GnPU7s-BU3f8b91SuvWz1DZg_RcOSFHQXuk19yd-hr2VeyogPXmcreilyJUhymelBDNWR9q7K2FEKqNstT5oLfZNtVMh0OuhapyNMyK7M8y4VIhBq6qldZLitZVaqFPOWZtEmMuc2JdeNBe79yXRUqVQdDLRu_VbYQC3_itghCxEJ3dTxzbNfRQ54a7YN_oQQdzPYk7DV-fNR4NNiFjGe8Wq-DvvGT_qcOU3wonmYoU7TLTy9ALGqPq4-boUwb7tcujv-YtI8qrc7UUwhXH92_uXzUYVrbpLMziEu82_13vDr7F3cBxGVj5EFcdsa3WvwTAAD__9MnZfM">