[Bug c++/13717] New: duplicated parameter name not caught ?

Joseph S. Myers jsm@polyomino.org.uk
Sat Jan 17 12:17:00 GMT 2004


On Sat, 17 Jan 2004, d dot binderman at virgin dot net wrote:

> The one liner
> 
> void f( int fred, char * fred);
> 
> is IMHO illegal code because fred is the name of two parameters.
> 
> I couldn't get gcc332 to find the bug in this code.
> This is salted down from real code in Fedora Core 1.

If you give the parameters the same type, then the C front end has
acquired such a bug as well in 3.4/3.5.  Neither

void f (int fred, int fred);

nor

void f (int fred, int fred) {}

now give a diagnostic for C.  I guess Zack's patches are the most likely
cause, or at least the subsequent ones the most likely fix.

(Sent to gcc-bugs rather than gcc-bugzilla because this is a separate bug.  
Shall I open a new PR for this regression or will this be fixed shortly
(with the above testcases included) in a subsequent stage of the c-decl.c
cleanup patches?)

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc-bugs mailing list