This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/711: -Wshadow gives spurious warning



>Number:         711
>Category:       c++
>Synopsis:       -Wshadow gives spurious warning
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 30 14:16:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Tom Tromey
>Release:        unknown-1.0
>Organization:
>Environment:
current cvs gcc on x86 Red Hat Linux 6.2
>Description:
Compile this C++ program with `-W -Wall -Wshadow':

class foo
{
public:
  unsigned char     *bytes;

  inline static int get1u (unsigned char* bytes)
  {
    return bytes[0];
  }
};


I get:
creche. gcc -W -Wall -Wshadow -fsyntax-only foo.cc
foo.cc: In static member function `int foo::get1u(unsigned char*)':
foo.cc:7: warning: declaration of `bytes' shadows previous local

I think this is wrong.  The name `bytes' as an argument
to get1u does not shadow the field, because the method
is static.

This particular bug leads to many spurious warnings if
I enable -Wshadow for libgcj.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]