Hi Joseph,
On Mon, Sep 15, 2025 at 07:07:14PM +0000, Joseph Myers wrote:
> On Mon, 15 Sep 2025, Alejandro Colomar wrote:
>
> > // Whatever, but at least should be self-consistent:
> > void l(void;); // ok
> > void m(void; void); // error: ‘void’ must be the only parameter and
> > unnamed
> > void n(void; int n); // error: parameter ‘({anonymous})’ has just a
> > forward declaration
> >
> > Regardless of whether we want l(), m(), and n() to be accepted, they
> > should either be all accepted or none accepted. I think all should be
> > accepted, but you might convince me otherwise.
>
> I think they should all be rejected. That is, all parameter forward
> declarations must declare a parameter, by name, that appears in a
> following list of parameter declarations. See also bug 23144 regarding
> forward declarations being wrongly accepted with no following declarations
> of parameters at all.
Ahhh, thanks! That bug explainst the inconsistency I experienced with
this.
What's your opinion about 'void f(; int x);'? Is that okay?
That is, ignoring the pre-existing bug that doesn't diagnose line 2,
would it be okay to you if we lift the errors from lines 4 and 5, as
below?
alx@debian:~/tmp$ cat void_fwd.c | nl
1 void f( void);
2 void f(void; );
3 void f(void; void);
4 void f( ; void);
5 void f( ; );
alx@debian:~/tmp$ /opt/local/gnu/gcc/fwd2/bin/gcc void_fwd.c
void_fwd.c:3:14: error: ‘void’ must be the only parameter and unnamed
3 | void f(void; void);
| ^~~~
void_fwd.c:3:8: error: parameter ‘({anonymous})’ has just a forward
declaration
3 | void f(void; void);
| ^~~~
> I think it would be best to separate fixing existing bugs relating to
> things that are wrongly accepted and not meaningful for the existing
> extension, from any changes that add new features or new diagnostics for
> things that are clearly meant to be valid with the existing extension.
Sure. I discuss them together, as they're related, but I certainly
intend to provide separate patches for every logically different issue.
Cheers,
Alex
--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
signature.asc
Description: PGP signature
