Issue 89983
Summary incorrect warning that a static member function parameter shadows an inherited member variable
Labels new issue
Assignees
Reporter torsten48
    `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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to