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

            Bug ID: 70910
           Summary: error declaring a type in clause-1 of a for statement
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Not sure if this is related to c/67784 but today's top of trunk as well as
prior versions fail to compile the following valid program.  Similarly with
"for (struct S { int i; } s; ; )"

$ cat u.c && /home/msebor/build/gcc-trunk-git/gcc/xgcc
-B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic -xc u.c
void h (void) {
  for (enum E { e } f; ; );
}
u.c: In function ‘h’:
u.c:2:3: error: declaration of non-variable ‘e’ in ‘for’ loop initial
declaration
   for (enum E { e } f; ; );
   ^~~
u.c:2:3: error: ‘enum E’ declared in ‘for’ loop initial declaration
u.c:2:21: warning: unused variable ‘f’ [-Wunused-variable]
   for (enum E { e } f; ; );
                     ^

Reply via email to