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

            Bug ID: 121951
           Summary: Inconsistent parsing of empty/void lists of parameters
                    in function declarators with forward declarations of
                    parameters
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foss+...@alejandro-colomar.es
  Target Milestone: ---

alx@debian:~/tmp$ cat void_fwd.c | nl -ba
     1  void f(void);
     2  void f(void; );
     3  void f(void; void);
     4  void f(    ; void);
     5  void f(    ; );
alx@debian:~/tmp$ gcc void_fwd.c 
void_fwd.c:3:14: error: ‘void’ must be the only parameter
    3 | void f(void; void);
      |              ^~~~
void_fwd.c:3:8: error: parameter ‘({anonymous})’ has just a forward declaration
    3 | void f(void; void);
      |        ^~~~
void_fwd.c:4:12: error: expected declaration specifiers or ‘...’ before ‘;’
token
    4 | void f(    ; void);
      |            ^
void_fwd.c:5:12: error: expected declaration specifiers or ‘...’ before ‘;’
token
    5 | void f(    ; );
      |            ^


I think that either we diagnose all of the lines 2,3,4,5, or we should diagnose
none of them.

Especially, it doesn't make sense to allow line 2, but disallow line 3.

Reply via email to