public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9400: Warning -Wshadow warns of shadowed declaration of THIS in local classes.
@ 2003-01-22 12:56 Raimond_Merkert
0 siblings, 0 replies; only message in thread
From: Raimond_Merkert @ 2003-01-22 12:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 9400
>Category: c++
>Synopsis: Warning -Wshadow warns of shadowed declaration of THIS in local classes.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jan 22 12:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Raimond_Merkert@raytheon.com
>Release: GCC 3.1
>Organization:
>Environment:
>Description:
When compiling the test code with "gcc -c -Wshadow", the following warning is emitted:
test.cpp: In constructor `A::a1()::B::B()':
test.cpp:5: warning: declaration of `this' shadows a parameter
test.cpp:3: warning: shadowed declaration is here
Note that this warning is not emitted if I don't declare a constructor in the local class (as in A::a2())
I think the warning should always be suppressed if 'this' is involved since it it not a variable as such.
I've observed this behaviour in the gcc 3.3 prerelease snapshot from 2003-01-13 as well. I've also observed it on Linux and Solaris.
>How-To-Repeat:
cat > test.cpp <<EOF
struct A {
void a1 () {
struct B { B() {} };
}
void a2 () {
struct B { };
}
};
EOF
gcc -c -Wshadow test.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-22 12:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 12:56 c++/9400: Warning -Wshadow warns of shadowed declaration of THIS in local classes Raimond_Merkert
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).