<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/89983>89983</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
incorrect warning that a static member function parameter shadows an inherited member variable
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
torsten48
</td>
</tr>
</table>
<pre>
`class base {
public:
int i;
};
class test : public base {
public:
int j;
static int fn1(int j) { return --j; }
static int fn2(int i) { return ++i; }
};
int main(void)
{}
`
produces the following warning (tested with clang 16, 17 and 18.1.0):
`<source>:11:24: warning: parameter 'i' shadows member inherited from type 'base' [-Wshadow-field]
static int fn2(int i) { return ++i; }
^
<source>:3:9: note: declared here
int i;
^`
Correctly, there is no warning regarding the class member j, but but mistakenly for the inherited i.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysk82SoyAQx5-mvXQlpWD8OHhIZiavsGfEVplFSAFOKm-_hTFfs7tVe1irFEr6_4f-dSO8V4MhamB3gN17IuYwWtcE63wgk1dJa7tLA0UqtfAeW-EJoTxA-g7pHvE0t1pJ4PvbD0RlAirgawiU74_58r0aBfIBge9Xh381_vxmhj6IoOSy1psMWHWNYnU0Q0dhdgY3m6jDeJa724uQrUL1TQjsAOygXsW_pxSlk1AGWPVlVQesviV_uMugSJ8lJ2e7WZLHMBL2Vmt7VmbAs3AmjsCqSIg6PKswotTCDJgVwN4wK1GYDrNqm23TuNWN0WMf_ubt7CQB_wC-zzLge5ZH2Kv9wl04MVEgh8BKBaxEP4rOnj1ONLXkUJmRnIpH6J2dMFxOFENjoWI07A6bH1fJplekO9j9F7p_fmD3sab3mhsHvo8E0NhAcexIauGow5Ec_a0pn11fy_JmnSMZ9CWSDtEDlUdj74VxNAjXxVks3LWXV2CfUdPOYXkn5YP4SUZfsLduCX4AVduka3hX81ok1GRlxus6rfMiGRspyqKVRUdZX9aCeJ0XVbrL2qquyl4UlKiGpSxPc5azlO_yYlvLnLVtRWXJS57LCvKUJqH0VuuvaWvdkCjvZ2qquq54okVL2i-3nTFDZ1wWgbF4-V0TNZt2HjzkqVY--IdLUEFTo4y8IroTCaMIKG4VX1n0s5FBWfPUZrf2EuaJxBr-JZwSraZkdroZQzj52NXsCOw4qDDO7VbaCdgxHmYdNidnP0kGYMclBQ_suKT4KwAA__8PIW8t">