expressions: make assign_expression() take an op argument
[smatch.git] / validation / c99-for-loop-decl.c
blobd382d3c9b34df035093f8ece222aad2662bd2e09
1 static int bad_scope(void)
3 int r = 0;
5 for (int i = 0; i < 10; i++) {
6 r = i;
9 return i; /* check-should-fail */
12 static int c99(void)
14 int r = 0;
16 for ( int i = 0; i < 10; i++) /* check-should-pass */
17 r = i;
18 for ( auto int j = 0; j < 10; j++) /* check-should-pass */
19 r = j;
20 for (register int k = 0; k < 10; k++) /* check-should-pass */
21 r = k;
22 for ( extern int l = 0; l < 10; l++) /* check-should-fail */
23 r = l;
24 for ( extern int m; m < 10; m++) /* check-should-fail */
25 r = m;
26 for ( static int n = 0; n < 10; n++) /* check-should-fail */
27 r = n;
28 return r;
32 * check-name: C99 for-loop declarations
34 * check-error-start
35 c99-for-loop-decl.c:22:27: error: non-local var 'l' in for-loop initializer
36 c99-for-loop-decl.c:24:27: error: non-local var 'm' in for-loop initializer
37 c99-for-loop-decl.c:26:27: error: non-local var 'n' in for-loop initializer
38 c99-for-loop-decl.c:9:16: error: undefined identifier 'i'
39 * check-error-end