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

            Bug ID: 121563
           Summary: inconsistency with repeated forward declarations of
                    parameters with , or ;
           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@devuan:~/tmp$ cat fwd2.c | nl -ba
     1  void f1(int x; int x; int x);
     2  void f2(int y, int y; int y);
     3  
     4  void f3(int a[]; int a[]; int a[]);
     5  void f4(int b[], int b[]; int b[]);
alx@devuan:~/tmp$ gcc -S -Wall -Wextra fwd2.c 
fwd2.c:2:20: error: redefinition of parameter ‘y’
    2 | void f2(int y, int y; int y);
      |                ~~~~^
fwd2.c:2:13: note: previous definition of ‘y’ with type ‘int’
    2 | void f2(int y, int y; int y);
      |         ~~~~^
fwd2.c:2:13: error: parameter ‘y’ has just a forward declaration
fwd2.c:5:22: error: redefinition of parameter ‘b’
    5 | void f4(int b[], int b[]; int b[]);
      |                  ~~~~^~~
fwd2.c:5:13: note: previous definition of ‘b’ with type ‘int *’
    5 | void f4(int b[], int b[]; int b[]);
      |         ~~~~^~~
fwd2.c:5:13: error: parameter ‘b’ has just a forward declaration


We get errors for the second forward declaration of parameters if we use ','
but not if we use ';'.  Should both behave consistently?  Which behavior do we
prefer?

Reply via email to