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

Reply via email to