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

--- Comment #11 from Christopher Bazley <Chris.Bazley at arm dot com> ---
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3681.pdf is the latest
version of my paper proposing standardisation of parameter forward
declarations. It includes the following new argument against permitting
duplicate forward declarations (which may or may not be persuasive to the
reader).

Declarations that are valid at file scope are invalid in function scope:

int x, x; // valid
void f()
{
  int x, x; // invalid
}

The main precedent for forward parameter declarations is tentative definitions
at file scope, but they cannot be treated exactly like tentative definitions
because redeclarations of parameters are only valid in a parameter list even
though their scope is the whole function, whereas a translation unit can
contain tentative definitions for an identifier anywhere at file scope.

If the above declaration were allowed in function scope, it would be ambiguous
because it could be interpreted either as one declaration shadowing another or
as a redeclaration. Duplicate forward parameter declarations are similarly
ambiguous.

Reply via email to