https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121563

--- Comment #3 from Christopher Bazley <Chris.Bazley at arm dot com> ---
I think this text from the ISO C standard is relevant:

"Different entities designated by the same identifier either have different
scopes or are in different name spaces"

"If the declarator or type specifier that declares the identifier appears
within the list of parameter declarations in a function prototype (not part of
a function definition), the identifier has function prototype scope, which
terminates at the end of the function declarator."

The two identifiers don't have different scopes or belong to different name
spaces, therefore they do not designate different entities.

Unfortunately, I cannot find any text specifically forbidding the same
identifier from appearing twice within a parameter list. Based on the text
above, if one did, then it would designate the same entity.

In any case, I'd expect the same rules to apply to a
parameter-forward-declaration-list if N3433 is adopted (see
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3433.pdf) as already apply to
a parameter-type-list.

Example 7 in the wording proposed by that paper includes

void n(int x, int x; int x); // invalid redeclaration of 'x'

and

void r(int x; int x; int x); // invalid syntax

Reply via email to