This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52953] New: g++-4.7.0 fails to detect function parameter name redeclarations.
- From: "meng at g dot clemson.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Apr 2012 21:36:29 +0000
- Subject: [Bug c++/52953] New: g++-4.7.0 fails to detect function parameter name redeclarations.
- Auto-submitted: auto-generated
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.