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

            Bug ID: 86716
           Summary: use of parameter outside function body before ‘++’
                    token
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follow:

#include <stdio.h>
int
f (int a, int b[a++], int c, int d[c++])
{
 printf ("%d %d\n", a, c);
}

int
main (void)
{
 int dummy[10];
 f (1, dummy, 1, dummy);
 return 0;
}

gcc rejects the code:

gcc code0.c.cpp 
code0.c.cpp:3:18: error: use of parameter outside function body before '++'
token
 f (int a, int b[a++], int c, int d[c++])
                  ^~
code0.c.cpp:3:21: error: expected ')' before ',' token
 f (int a, int b[a++], int c, int d[c++])
   ~                 ^
                     )
code0.c.cpp:3:23: error: expected unqualified-id before 'int'
 f (int a, int b[a++], int c, int d[c++])
                       ^~~

clang accepts the code. The above code looks legal?

Reply via email to