-Wshadow is silly about this piece of code: --------------------------------- class Foo { int bar_; public: void bar(int bar) { bar_ = bar; } }; --------------------------------- This is a fairly common style. Note that local and member variable have names that differ by the underscore. Yet:
g/x> c++ -Wshadow -c x.cc x.cc: In member function 'void Foo::bar(int)': x.cc:5: warning: declaration of 'bar' shadows a member of 'this' I think that's being overly pedantic. W. -- Summary: -Wshadow warns about variable names that aren't equal Product: gcc Version: 4.2.1 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37831