c++/711: -Wshadow gives spurious warning
tromey@redhat.com
tromey@redhat.com
Mon Oct 30 14:16:00 GMT 2000
>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:
More information about the Gcc-bugs
mailing list