This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37831] New: -Wshadow warns about variable names that aren't equal
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Oct 2008 01:36:58 -0000
- Subject: [Bug c++/37831] New: -Wshadow warns about variable names that aren't equal
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
-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