[Bug c++/57709] -Wshadow is too strict / has false positives

jan.kratochvil at redhat dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 19 17:15:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57709

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31248|0                           |1
        is obsolete|                            |

--- Comment #10 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Created attachment 31252
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31252&action=edit
Comment 9 patch as a file

Yes, it works for me now, thanks:

shadow2.C: In member function ‘void C::m()’:
shadow2.C:4:18: warning: declaration of ‘both_var’ shadows a member of ‘C’
[-Wshadow]
   void m() { int both_var, var_and_method; }
                  ^
shadow2.C:2:7: note: shadowed declaration is here
   int both_var;
       ^
shadow2.C:4:18: warning: unused variable ‘both_var’ [-Wunused-variable]
   void m() { int both_var, var_and_method; }
                  ^
shadow2.C:4:28: warning: unused variable ‘var_and_method’ [-Wunused-variable]
   void m() { int both_var, var_and_method; }
                            ^

BTW copy-pasting patches here is very inconvenient.


More information about the Gcc-bugs mailing list