1 /* Test diagnostics for array references. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu89" } */
6 struct s
{ char c
[1]; };
32 /* These two should be treated the same. In particular, a "neither
33 array nor pointer" bogus warning used to be given for the
37 /* Various invalid cases. */
38 c
[c
]; /* { dg-error "subscripted value is neither array nor pointer nor vector" } */
39 p
[1.0]; /* { dg-error "array subscript is not an integer" } */
40 1.0[a
]; /* { dg-error "array subscript is not an integer" } */
41 fp
[0]; /* { dg-error "subscripted value is pointer to function" } */
42 0[fp
]; /* { dg-error "subscripted value is pointer to function" } */
43 pv
[0]; /* { dg-warning "dereferencing 'void \\*' pointer" } */
44 0[pv
]; /* { dg-warning "dereferencing 'void \\*' pointer" } */
45 sip
[0]; /* { dg-error "invalid use of undefined type 'struct si'" } */
46 /* { dg-error "dereferencing pointer to incomplete type" "incomplete" { target *-*-* } .-1 } */
47 0[sip
]; /* { dg-error "invalid use of undefined type 'struct si'" } */