[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / for.c
blobd0c2f7f21a960e6170825a50df5c1a6ef05153a3
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Check C99 6.8.5p3
4 void b1 (void) { for (void (*f) (void);;); }
5 void b2 (void) { for (void f (void);;); } // expected-error {{non-variable declaration in 'for' loop}}
6 void b3 (void) { for (static int f;;); } // expected-error {{declaration of non-local variable}}
7 void b4 (void) { for (typedef int f;;); } // expected-error {{non-variable declaration in 'for' loop}}
8 void b5 (void) { for (struct { int i; } s;;); }
9 void b6 (void) { for (enum { zero, ten = 10 } i;;); }
10 void b7 (void) { for (struct s { int i; };;); } // expected-error {{non-variable declaration in 'for' loop}}
11 void b8 (void) { for (static struct { int i; } s;;); } // expected-error {{declaration of non-local variable}}
12 void b9 (void) { for (struct { int i; } (*s)(struct { int j; } o) = 0;;); }
13 void b10(void) { for (typedef struct { int i; } (*s)(struct { int j; });;); } // expected-error {{non-variable declaration in 'for' loop}}