2009-02-02 23:00:55 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify %s
|
|
|
|
// PR3459
|
|
|
|
struct bar {
|
|
|
|
char n[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct foo {
|
|
|
|
char name[(int)&((struct bar *)0)->n];
|
2009-02-19 16:45:23 +08:00
|
|
|
char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{array size is negative}}
|
2009-02-02 23:00:55 +08:00
|
|
|
};
|
2009-02-03 08:34:39 +08:00
|
|
|
|
|
|
|
// PR3430
|
|
|
|
struct s {
|
|
|
|
struct st {
|
|
|
|
int v;
|
|
|
|
} *ts;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct st;
|
|
|
|
|
|
|
|
int foo() {
|
|
|
|
struct st *f;
|
|
|
|
return f->v + f[0].v;
|
|
|
|
}
|
2009-02-22 08:20:44 +08:00
|
|
|
|
2009-03-07 07:41:27 +08:00
|
|
|
// PR3642, PR3671
|
2009-02-22 08:20:44 +08:00
|
|
|
struct pppoe_tag {
|
|
|
|
short tag_type;
|
|
|
|
char tag_data[];
|
|
|
|
};
|
|
|
|
struct datatag {
|
2009-03-07 07:46:13 +08:00
|
|
|
struct pppoe_tag hdr; //expected-warning{{field of variable sized type 'hdr' not at the end of a struct or class is a GNU extension}}
|
2009-02-22 08:20:44 +08:00
|
|
|
char data;
|
|
|
|
};
|
|
|
|
|