27 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3//4// RUN: %clang_cc1 -fsyntax-only -fstrict-flex-arrays=2 -verify=warn %s5 6@interface Flexible {7@public8 char flexible[];9}10@end11 12@interface Flexible0 {13@public14 char flexible[0];15}16@end17 18@interface Flexible1 {19@public20 char flexible[1];21}22@end23 24char readit(Flexible *p) { return p->flexible[2]; }25char readit0(Flexible0 *p) { return p->flexible[2]; }26char readit1(Flexible1 *p) { return p->flexible[2]; } // warn-warning {{array index 2 is past the end of the array (that has type 'char[1]')}}27