[LLVMbugs] [Bug 6808] New: -Wshadow warns about shadowing inaccessible fields

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 9 12:46:27 PDT 2010


           Summary: -Wshadow warns about shadowing inaccessible fields
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ori at avtalion.name
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Using trunk r100808.

In the following example, the static method cannot access the non-static field.
Having a variable with the same name shouldn't trigger a warning.

$ cat a.cpp
class Foo {
    int a;

    static void b() {
        int a;

$ clang++ -Wshadow -c a.cpp 
a.cpp:5:7: warning: declaration shadows a field of 'Foo' [-Wshadow]
                int a;
a.cpp:2:6: note: previous declaration is here
        int a;

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list