From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28496 invoked by alias); 15 Oct 2008 01:38:12 -0000 Received: (qmail 27846 invoked by uid 48); 15 Oct 2008 01:36:58 -0000 Date: Wed, 15 Oct 2008 01:38:00 -0000 Subject: [Bug c++/37831] New: -Wshadow warns about variable names that aren't equal X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bangerth at dealii dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg00955.txt.bz2 -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