This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/711: -Wshadow gives spurious warning
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/711: -Wshadow gives spurious warning
- From: tromey at redhat dot com
- Date: 30 Oct 2000 22:10:44 -0000
- Reply-To: tromey at redhat dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, tromey@redhat.com
>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: