[Bug c++/13717] duplicated parameter name not caught ?
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 29 22:34:00 GMT 2006
------- 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
More information about the Gcc-bugs
mailing list