On Mon, 8 Sep 2025, Alejandro Colomar wrote:

> BTW, I'm wondering about the following:
> 
>       alx@debian:~/tmp$ cat fwd.c
>       void j(void; int x);
>       void k(void; void);
>       void l(void; ...);
>       alx@debian:~/tmp$ gcc fwd.c
>       fwd.c:1:8: error: parameter ‘({anonymous})’ has just a forward 
> declaration
>           1 | void j(void; int x);
>             |        ^~~~
>       fwd.c:2:14: error: ‘void’ must be the only parameter
>           2 | void k(void; void);
>             |              ^~~~
>       fwd.c:2:8: error: parameter ‘({anonymous})’ has just a forward 
> declaration
>           2 | void k(void; void);
>             |        ^~~~
> 
> These should be supported as well (even with more priority than empty
> lists).  (I never liked C23's decission of allowing () as synonyn for
> (void).)

I don't think we should support any of these.  We tightened up various 
cases of void in parameter lists in C2y (constraint "A parameter 
declaration shall not specify a void type, except for the special case of 
a single unnamed parameter of type void with no storage-class specifier, 
no type qualifier, and no following ellipsis terminator.", replacing 
previous implicit UB), and shouldn't loosen it.  Rather, any standard 
version of parameter forward declarations should disallow (explicitly or 
implicitly) use of void like that in forward declarations.  (It's probably 
OK to allow (; void) if you allow an empty forward declaration list, 
provided it's clear from normative text that it means the same as (void) 
and ().)

-- 
Joseph S. Myers
[email protected]

Reply via email to