1 /* Test for C99 declarations in for loops. Test constraints are diagnosed with
2 -Wc11-c23-compat for C23. Based on c99-fordecl-2.c. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c23 -pedantic-errors -Wc11-c23-compat" } */
10 for (int i
= 1, bar (void); i
<= 10; i
++) /* { dg-warning "bar" } */
13 for (static int i
= 1; i
<= 10; i
++) /* /* { dg-warning "static" } */
16 for (extern int i
; j
<= 500; j
++) /* { dg-warning "extern" } */
19 for (enum { FOO
} i
= FOO
; i
< 10; i
++) /* { dg-warning "FOO" } */
22 for (enum BAR
{ FOO
} i
= FOO
; i
< 10; i
++) /* { dg-warning "FOO" } */
23 /* { dg-warning "BAR" "enum tag in for loop" { target *-*-* } .-1 } */
25 for (typedef int T
;;) /* { dg-warning "non-variable" } */