public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++
@ 2007-01-23 23:21 geoffk at gcc dot gnu dot org
2007-02-11 3:57 ` [Bug c++/30566] " bangerth at dealii dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-01-23 23:21 UTC (permalink / raw)
To: gcc-bugs
The following program:
void f( int x )
{
class InnerClass
{
public:
static void g( int x )
{
// empty
}
};
}
produces a warning:
t.cc: In static member function 'static void f(int)::InnerClass::g(int)':
t.cc:7: warning: declaration of 'int x' shadows a parameter
t.cc:1: warning: shadowed declaration is here
But it would be invalid for any function in InnerClass to try and use the outer
"int x" (and in fact if you try it, you correctly get an error).
--
Summary: -Wshadow warns about clashes between nested function
parameters in C++
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: geoffk at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30566
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/30566] -Wshadow warns about clashes between nested function parameters in C++
2007-01-23 23:21 [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++ geoffk at gcc dot gnu dot org
@ 2007-02-11 3:57 ` bangerth at dealii dot org
2010-05-07 13:57 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2007-02-11 3:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from bangerth at dealii dot org 2007-02-11 03:57 -------
Confirmed.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-02-11 03:57:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30566
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/30566] -Wshadow warns about clashes between nested function parameters in C++
2007-01-23 23:21 [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++ geoffk at gcc dot gnu dot org
2007-02-11 3:57 ` [Bug c++/30566] " bangerth at dealii dot org
@ 2010-05-07 13:57 ` jason at gcc dot gnu dot org
2010-05-14 3:19 ` pzhao at gcc dot gnu dot org
2010-05-14 9:43 ` paolo dot carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-07 13:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jason at gcc dot gnu dot org 2010-05-07 13:57 -------
*** Bug 41825 has been marked as a duplicate of this bug. ***
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30566
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/30566] -Wshadow warns about clashes between nested function parameters in C++
2007-01-23 23:21 [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++ geoffk at gcc dot gnu dot org
2007-02-11 3:57 ` [Bug c++/30566] " bangerth at dealii dot org
2010-05-07 13:57 ` jason at gcc dot gnu dot org
@ 2010-05-14 3:19 ` pzhao at gcc dot gnu dot org
2010-05-14 9:43 ` paolo dot carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: pzhao at gcc dot gnu dot org @ 2010-05-14 3:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pzhao at gcc dot gnu dot org 2010-05-14 03:19 -------
Subject: Bug 30566
Author: pzhao
Date: Fri May 14 03:19:32 2010
New Revision: 159383
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159383
Log:
gcc/cp/
2010-05-14 Shujing Zhao <pearly.zhao@oracle.com>
PR c++/30566
* name-lookup.c (pushdecl_maybe_friend): Avoid the warnings about
shadowing the outer parameter or variables by the declaration of
nested function in nested structure or class. Warn the shadowing by
the declaration of nested lambda expression.
gcc/testsuite/
2010-05-14 Shujing Zhao <pearly.zhao@oracle.com>
PR c++/30566
* testsuite/g++.dg/warn/Wshadow-4.C: Adjust.
* testsuite/g++.dg/warn/Wshadow-5.C: New test.
* testsuite/g++.dg/warn/Wshadow-6.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wshadow-5.C
trunk/gcc/testsuite/g++.dg/warn/Wshadow-6.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/name-lookup.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/warn/Wshadow-4.C
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30566
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/30566] -Wshadow warns about clashes between nested function parameters in C++
2007-01-23 23:21 [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++ geoffk at gcc dot gnu dot org
` (2 preceding siblings ...)
2010-05-14 3:19 ` pzhao at gcc dot gnu dot org
@ 2010-05-14 9:43 ` paolo dot carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-14 9:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo dot carlini at oracle dot com 2010-05-14 09:43 -------
Fixed for 4.6.0.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30566
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-14 9:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 23:21 [Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++ geoffk at gcc dot gnu dot org
2007-02-11 3:57 ` [Bug c++/30566] " bangerth at dealii dot org
2010-05-07 13:57 ` jason at gcc dot gnu dot org
2010-05-14 3:19 ` pzhao at gcc dot gnu dot org
2010-05-14 9:43 ` paolo dot carlini at oracle dot com
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).