#include<iostream>
class base {
public:
int i;
};
class test : public base {
public:
static int fn1(int j) { return --j; }
static int fn2(int i) { return ++i; }
int j;
};
int main(int, char**)
{
int j =test::fn1(1);
int k =test::fn2(1);
std::cout << "j:" << j << "k:" << k << std::endl;
return 0;
}
produces the following warning (tested with clang 16 up to 18.1.0):
<source>:11:24: warning: parameter 'i' shadows member inherited from type 'base' [-Wshadow-field]
11 | static int fn2(int i) { return ++i; }
| ^
<source>:5:9: note: declared here
5 | int i;
| ^
1 warning generated.
As you can see the (incorrect) warning is only produced for the inherited variable.
I would assume this is a bug, where to report this, GitHub?