1 /* RUN: %clang_cc1 -std=c89 -Wno-gcc-compat -ast-dump -o - %s | FileCheck %s
2 RUN: %clang_cc1 -std=c99 -ast-dump -o - %s | FileCheck %s
3 RUN: %clang_cc1 -std=c11 -ast-dump -o - %s | FileCheck %s
4 RUN: %clang_cc1 -std=c17 -ast-dump -o - %s | FileCheck %s
5 RUN: %clang_cc1 -std=c2x -ast-dump -o - %s | FileCheck %s
6 */
7
8 /* WG14 DR466: yes
9 * Scope of a for loop control declaration
10 */
dr466(void)11 int dr466(void) {
12 for (int i = 0; ; ) {
13 long i = 1; /* valid C, invalid C++ */
14 // ...
15 return i; /* (perhaps unexpectedly) returns 1 in C */
16 }
17 }
18
19 /*
20 CHECK: FunctionDecl 0x{{.+}} dr466 'int (void)'
21 CHECK-NEXT: CompoundStmt
22 CHECK-NEXT: ForStmt
23 CHECK-NEXT: DeclStmt
24 CHECK-NEXT: VarDecl 0x{{.+}} {{.+}} i 'int'
25 CHECK: CompoundStmt
26 CHECK-NEXT: DeclStmt
27 CHECK-NEXT: VarDecl [[ACTUAL:0x.+]] <col:{{.+}}> col:{{.+}} used i 'long'
28 CHECK: ReturnStmt
29 CHECK: DeclRefExpr 0x{{.+}} <col:{{.+}}> 'long' lvalue Var [[ACTUAL]] 'i' 'long'
30 */
31