blob: 1ca3cd7aec903fc17da67490bda8bea87483c6f4 [file] [log] [blame]
Steve Naroff26b8ff42007-08-26 14:38:38 +00001// RUN: clang -parse-ast-check -pedantic %s
Chris Lattner5265af52007-07-19 00:42:40 +00002
3struct s;
4struct s* t (struct s z[]) { // expected-error {{array has incomplete element type}}
Chris Lattnerce7f4cc2007-08-26 06:48:28 +00005 return z;
Chris Lattner5265af52007-07-19 00:42:40 +00006}
7
Steve Naroff53a32342007-08-28 18:45:29 +00008void ff() {
9 struct s v, *p; // expected-error {{variable has incomplete type 'struct s'}}
10
11 p = &v;
12}
13
Chris Lattner5265af52007-07-19 00:42:40 +000014void *k (void l[2]) { // expected-error {{array has incomplete element type}}
15 return l;
16}
17
Steve Naroff26b8ff42007-08-26 14:38:38 +000018struct vari {
19 int a;
20 int b[];
21};
22
23struct vari *func(struct vari a[]) { // expected-error {{'struct vari' may not be used as an array element due to flexible array member}}
24 return a;
25}
26
27int foo[](void); // expected-error {{'foo' declared as array of functions}}
28
29typedef int (*pfunc)(void);
30
31pfunc xx(int f[](void)) { // expected-error {{'f' declared as array of functions}}
32 return f;
33}
Steve Naroff42471f82007-08-30 22:35:45 +000034
35void check_size() {
36 float f;
37 int size_not_int[f]; // expected-error {{size of array has non-integer type 'float'}}
38 int negative_size[1-2]; // expected-error{{array size is negative}}
39 int zero_size[0]; // expected-warning{{zero size arrays are an extension}}
40}
41