Debian Codegraph @

clang/test/SemaObjC/flexible-array-bounds.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3 //
4 // RUN: %clang_cc1 -fsyntax-only -fstrict-flex-arrays=2 -verify=warn %s
5
6 @interface Flexible {
7 @public
8 char flexible[];
9 }
10 @end
11
12 @interface Flexible0 {
13 @public
14 char flexible[0];
15 }
16 @end
17
18 @interface Flexible1 {
19 @public
20 char flexible[1];
21 }
22 @end
23
24 char readit(Flexible *p) { return p->flexible[2]; }
25 char readit0(Flexible0 *p) { return p->flexible[2]; }
26 char readit1(Flexible1 *p) { return p->flexible[2]; } // warn-warning {{array index 2 is past the end of the array (that has type 'char[1]')}}