public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/5711: Questionable -Wshadow warning for function template's local variable
@ 2002-02-17 2:06 hiroki
0 siblings, 0 replies; 2+ messages in thread
From: hiroki @ 2002-02-17 2:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 5711
>Category: c++
>Synopsis: Questionable -Wshadow warning for function template's local variable
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 17 02:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Hiroki Horiuchi
>Release: 3.0.3
>Organization:
>Environment:
CYGWIN_NT-5.0 1.3.3(0.46/3/2) 2001-09-12 23:54 i686 unknown
>Description:
file attached is warned as below when -Wshadow given.
a.c: In function `T a(T) [with T = int]':
a.c:27: instantiated from here
a.c:4: warning: declaration of `x' shadows global declaration
a.c: In function `T b() [with T = int]':
a.c:27: instantiated from here
a.c:12: warning: declaration of `x' shadows global declaration
a.c: In function `T c() [with T = int]':
a.c:27: instantiated from here
a.c:20: warning: declaration of `x' shadows global declaration
bash-2.05$ g++ -v
Reading specs from /1/gcc-3.0.3/lib/gcc-lib/i686-pc-cygwin/3.0.3/specs
Configured with: ./configure --prefix=/1/gcc-3.0.3
Thread model: single
gcc version 3.0.3
>How-To-Repeat:
g++ -fsyntax-only -Wshadow a.c
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="a.c"
Content-Disposition: inline; filename="a.c"
template<class T>
T
a(T x)
{
return x;
}
template<class T>
T
b()
{
T x = 0;
return x;
}
template<class T>
T
c()
{
static T x = 0;
return x;
}
int
x()
{
return a(0) + b<int>() + c<int>();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/5711: Questionable -Wshadow warning for function template's local variable
@ 2002-02-17 5:24 neil
0 siblings, 0 replies; 2+ messages in thread
From: neil @ 2002-02-17 5:24 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, hiroki, neil, nobody
Synopsis: Questionable -Wshadow warning for function template's local variable
Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Sun Feb 17 05:24:39 2002
Responsible-Changed-Why:
Boku-no da kara.
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sun Feb 17 05:24:39 2002
State-Changed-Why:
This appears to have been fixed in the 3.1 branch.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5711
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-02-17 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-17 2:06 c++/5711: Questionable -Wshadow warning for function template's local variable hiroki
2002-02-17 5:24 neil
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).