public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37831]  New: -Wshadow warns about variable names that aren't equal
@ 2008-10-15  1:38 bangerth at dealii dot org
  2008-10-15  1:39 ` [Bug c++/37831] " bangerth at dealii dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2008-10-15  1:38 UTC (permalink / raw)
  To: gcc-bugs

-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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-15  1:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-15  1:38 [Bug c++/37831] New: -Wshadow warns about variable names that aren't equal bangerth at dealii dot org
2008-10-15  1:39 ` [Bug c++/37831] " bangerth at dealii dot org
2008-10-15  1:42 ` [Bug c++/37831] -Wshadow warns about variables inside classes member functions pinskia at gcc dot gnu dot org
2008-10-15  1:52 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).