[LLVMbugs] [Bug 13404] New: Extraneous -Wshadow diagnostic for local variable redefinition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 19 10:09:20 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13404

             Bug #: 13404
           Summary: Extraneous -Wshadow diagnostic for local variable
                    redefinition
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: seth.cantrell at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The code:

struct S {};

int main() {
    S S;
    struct S S;
}

results in two diagnostics:

ConsoleApplication1.cpp:5:14: warning: declaration shadows a local variable
[-Wshadow]
    struct S S;
             ^
ConsoleApplication1.cpp:4:7: note: previous declaration is here
    S S;
      ^
ConsoleApplication1.cpp:5:14: error: redefinition of 'S'
    struct S S;
             ^
ConsoleApplication1.cpp:4:7: note: previous definition is here
    S S;
      ^

The -Wshadow diagnostic should not trigger when the declaration is in fact an
illegal redefinition.

-- 
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