This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52953] New: g++-4.7.0 fails to detect function parameter name redeclarations.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52953

             Bug #: 52953
           Summary: g++-4.7.0 fails to detect function parameter name
                    redeclarations.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: meng@g.clemson.edu


source code demonstrating the problem.
------------------------------- BEGIN ----------------------------
void f (int i) try
{
 void i (); // 1
}
catch (...)
{
 void i (); // 2
}

int main ()
{
 return 0;
}
-------------------------------  END  ----------------------------

compiled with :
$HOME/gcc/4.7.0/bin/c++ -std=c++0x -Wall -O3 tt.cc

compiler output : 
nothing

g++-4.7.0 accepts the code as it is, issuing no warnings and no errors. I think
this is wrong. According to c++11 3.3.3/2 
"A parameter name shall not be redeclared in the outermost block of the
function definition nor in the outermost block of any handler associated with a
function-try-block."

In the above example, i is the name of the parameter of function f. The name i,
therefore, cannot be redeclared in the outermost block of the function
definition (case 1) nor can it be redeclared in the outermost block of any
associated handler (case 2). But my g++ accepts both cases while they should be
rejected.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]