This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13717] duplicated parameter name not caught ?
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 May 2006 22:34:09 -0000
- Subject: [Bug c++/13717] duplicated parameter name not caught ?
- References: <bug-13717-1563@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from dcb314 at hotmail dot com 2006-05-29 22:34 -------
(In reply to comment #5)
> Based on 8.3.5/8 and the example from 8.3.6/9 which reads
>
> int f(int a, int b = a);
>
> I think this bug is invalid and function declarations with duplicate parameter
> names are not invalid.
I don't understand how the line of code you mention helps
demonstrate your logic. Two parameters are declared, one
called a and one called b.
In the standard, the end of paragraph 8.3.5.7 says
If a parameter name is present in a function
declaration that is not a definition, it cannot be used outside of the
parameter-declaration-clause since it goes out of scope at the end of
the function declarator
So it implies that a new scope is entered at the (
and exited at the ). But we already know that a name can't
be reused at the same scope [ except for function overloading,
but that's different]. QED.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13717