https://bugs.llvm.org/show_bug.cgi?id=43329

            Bug ID: 43329
           Summary: -Wshadow-field triggered in static member functions
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

-Wshadow-field is triggered in static member functions for inherited,
non-static data members. Is this actually helpful? Since static member
functions don't have access to a this pointer anyway (and no implicit access to
its data members when "this->" is omitted), there can be no ambiguity.

See https://wandbox.org/permlink/Fsdh6hvPhoCurwo5

class C {
public:
    int x;
};

class D : public C {
public:
    static int f (int x) { return x; }
};

int main() {}

Results in warning: parameter 'x' shadows member inherited from type 'C'
[-Wshadow-field]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to