1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc struct s; // expected-note 2 {{forward declaration of 'struct s'}} t(struct s z[])4*f4a2713aSLionel Sambucstruct s* t (struct s z[]) { // expected-error {{array has incomplete element type}} 5*f4a2713aSLionel Sambuc return z; 6*f4a2713aSLionel Sambuc } 7*f4a2713aSLionel Sambuc ff()8*f4a2713aSLionel Sambucvoid ff() { 9*f4a2713aSLionel Sambuc struct s v, *p; // expected-error {{variable has incomplete type 'struct s'}} 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc p = &v; 12*f4a2713aSLionel Sambuc } 13*f4a2713aSLionel Sambuc k(void l[2])14*f4a2713aSLionel Sambucvoid *k (void l[2]) { // expected-error {{array has incomplete element type}} 15*f4a2713aSLionel Sambuc return l; 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc struct vari { 19*f4a2713aSLionel Sambuc int a; 20*f4a2713aSLionel Sambuc int b[]; 21*f4a2713aSLionel Sambuc }; 22*f4a2713aSLionel Sambuc func(struct vari a[])23*f4a2713aSLionel Sambucstruct vari *func(struct vari a[]) { // expected-warning {{'struct vari' may not be used as an array element due to flexible array member}} 24*f4a2713aSLionel Sambuc return a; 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc int foo[](void); // expected-error {{'foo' declared as array of functions}} 28*f4a2713aSLionel Sambuc int foo2[1](void); // expected-error {{'foo2' declared as array of functions}} 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc typedef int (*pfunc)(void); 31*f4a2713aSLionel Sambuc xx(int f[](void))32*f4a2713aSLionel Sambucpfunc xx(int f[](void)) { // expected-error {{'f' declared as array of functions}} 33*f4a2713aSLionel Sambuc return f; 34*f4a2713aSLionel Sambuc } 35*f4a2713aSLionel Sambuc check_size()36*f4a2713aSLionel Sambucvoid check_size() { 37*f4a2713aSLionel Sambuc float f; 38*f4a2713aSLionel Sambuc int size_not_int[f]; // expected-error {{size of array has non-integer type 'float'}} 39*f4a2713aSLionel Sambuc int negative_size[1-2]; // expected-error{{array with a negative size}} 40*f4a2713aSLionel Sambuc int zero_size[0]; // expected-warning{{zero size arrays are an extension}} 41*f4a2713aSLionel Sambuc } 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc static int I; 44*f4a2713aSLionel Sambuc typedef int TA[I]; // expected-error {{variable length array declaration not allowed at file scope}} 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc void strFunc(char *); // expected-note{{passing argument to parameter here}} 47*f4a2713aSLionel Sambuc const char staticAry[] = "test"; checkStaticAry()48*f4a2713aSLionel Sambucvoid checkStaticAry() { 49*f4a2713aSLionel Sambuc strFunc(staticAry); // expected-warning{{passing 'const char [5]' to parameter of type 'char *' discards qualifiers}} 50*f4a2713aSLionel Sambuc } 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc 53