[Bug c++/30566] New: -Wshadow warns about clashes between nested function parameters in C++
geoffk at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Jan 23 23:21:00 GMT 2007
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
More information about the Gcc-bugs
mailing list