[llvm-bugs] [Bug 43329] New: -Wshadow-field triggered in static member functions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 16 07:04:47 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: dan.raviv at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

-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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190916/55a26065/attachment.html>


More information about the llvm-bugs mailing list