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++/13717] duplicated parameter name not caught ?



------- 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


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