[llvm-bugs] [Bug 34120] New: -Wshadow false-negative compared to gcc

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 8 09:07:51 PDT 2017


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

            Bug ID: 34120
           Summary: -Wshadow false-negative compared to gcc
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

class A {
  int B;
};
class C : A {
  void D(int B) {}
};

$ clang++-6.0 -Wshadow -c wshadow.cpp
$ clang++-5.0 -Wshadow -c wshadow.cpp
$ clang++-4.0 -Wshadow -c wshadow.cpp
$ clang++-3.9 -Wshadow -c wshadow.cpp
$ g++-7 -Wshadow -c wshadow.cpp
wshadow.cpp: In member function ‘void C::D(int)’:
wshadow.cpp:5:17: warning: declaration of ‘B’ shadows a member of ‘C’
[-Wshadow]
   void D(int B) {}
                 ^
wshadow.cpp:2:7: note: shadowed declaration is here
   int B;
       ^
$ g++-6 -Wshadow -c wshadow.cpp
wshadow.cpp: In member function ‘void C::D(int)’:
wshadow.cpp:5:17: warning: declaration of ‘B’ shadows a member of ‘C’
[-Wshadow]
   void D(int B) {}
                 ^
wshadow.cpp:2:7: note: shadowed declaration is here
   int B;
       ^
$ g++-5 -Wshadow -c wshadow.cpp
wshadow.cpp: In member function ‘void C::D(int)’:
wshadow.cpp:5:17: warning: declaration of ‘B’ shadows a member of ‘C’
[-Wshadow]
   void D(int B) {}
                 ^
wshadow.cpp:2:7: note: shadowed declaration is here
   int B;
       ^

-- 
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/20170808/e9f44376/attachment.html>


More information about the llvm-bugs mailing list