1 /* Test for C99 declarations in for loops. Test constraints. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
9 /* See comments in check_for_loop_decls (c-decl.c) for the presumptions
10 behind these tests. */
12 for (int i
= 1, bar (void); i
<= 10; i
++) /* { dg-bogus "warning" "warning in place of error" } */
13 /* { dg-error "bar" "function in for loop" { target *-*-* } .-1 } */
16 for (static int i
= 1; i
<= 10; i
++) /* { dg-bogus "warning" "warning in place of error" } */
17 /* { dg-error "static" "static in for loop" { target *-*-* } .-1 } */
20 for (extern int i
; j
<= 500; j
++) /* { dg-bogus "warning" "warning in place of error" } */
21 /* { dg-error "extern" "extern in for loop" { target *-*-* } .-1 } */
24 for (enum { FOO
} i
= FOO
; i
< 10; i
++) /* { dg-bogus "warning" "warning in place of error" } */
25 /* { dg-error "FOO" "enum value in for loop" { target *-*-* } .-1 } */
28 for (enum BAR
{ FOO
} i
= FOO
; i
< 10; i
++) /* { dg-bogus "warning" "warning in place of error" } */
29 /* { dg-error "FOO" "enum value in for loop" { target *-*-* } .-1 } */
30 /* { dg-error "BAR" "enum tag in for loop" { target *-*-* } .-2 } */