diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Sema/struct-decl.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Sema/struct-decl.c')
-rw-r--r-- | clang/test/Sema/struct-decl.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/clang/test/Sema/struct-decl.c b/clang/test/Sema/struct-decl.c new file mode 100644 index 0000000..6070e87 --- /dev/null +++ b/clang/test/Sema/struct-decl.c @@ -0,0 +1,59 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// PR3459 +struct bar { + char n[1]; +}; + +struct foo { + char name[(int)&((struct bar *)0)->n]; + char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{'name2' declared as an array with a negative size}} +}; + +// PR3430 +struct s { + struct st { + int v; + } *ts; +}; + +struct st; + +int foo() { + struct st *f; + return f->v + f[0].v; +} + +// PR3642, PR3671 +struct pppoe_tag { + short tag_type; + char tag_data[]; +}; +struct datatag { + struct pppoe_tag hdr; //expected-warning{{field 'hdr' with variable sized type 'struct pppoe_tag' not at the end of a struct or class is a GNU extension}} + char data; +}; + + +// PR4092 +struct s0 { + char a; // expected-note {{previous declaration is here}} + char a; // expected-error {{duplicate member 'a'}} +}; + +struct s0 f0(void) {} + +// <rdar://problem/8177927> - This previously triggered an assertion failure. +struct x0 { + unsigned int x1; +}; + +// rdar://problem/9150338 +static struct test1 { // expected-warning {{'static' ignored on this declaration}} + int x; +}; +const struct test2 { // expected-warning {{'const' ignored on this declaration}} + int x; +}; +inline struct test3 { // expected-warning {{'inline' ignored on this declaration}} + int x; +}; |