1 // RUN: %clang_cc1 -Wno-pointer-to-int-cast -fsyntax-only -verify %s
8 char name
[(int)&((struct bar
*)0)->n
]; // expected-warning {{folded to constant}}
9 char name2
[(int)&((struct bar
*)0)->n
- 1]; // expected-error {{array size is negative}}
32 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}}
39 char a
; // expected-note {{previous declaration is here}}
40 char a
; // expected-error {{duplicate member 'a'}}
45 // <rdar://problem/8177927> - This previously triggered an assertion failure.
50 // rdar://problem/9150338
51 static struct test1
{ // expected-warning {{'static' ignored on this declaration}}
54 const struct test2
{ // expected-warning {{'const' ignored on this declaration}}
57 inline struct test3
{ // expected-error {{'inline' can only appear on functions}}
63 void test_hiding(void) {
64 struct hiding_1
*hiding_1(void);
65 extern struct hiding_2
*hiding_2
;
66 struct hiding_1
*p
= hiding_1();
67 struct hiding_2
*q
= hiding_2
;
70 struct PreserveAttributes
{};
71 typedef struct __attribute__((noreturn
)) PreserveAttributes PreserveAttributes_t
; // expected-warning {{'noreturn' attribute only applies to functions and methods}}
74 struct FlexibleArrayMem
{
79 struct FollowedByNamed
{
80 struct FlexibleArrayMem a
; // expected-warning {{field 'a' with variable sized type 'struct FlexibleArrayMem' not at the end of a struct or class is a GNU extension}}
84 struct FollowedByUnNamed
{
85 struct FlexibleArrayMem a
; // expected-warning {{field 'a' with variable sized type 'struct FlexibleArrayMem' not at the end of a struct or class is a GNU extension}}
92 struct { // expected-warning-re {{field '' with variable sized type 'struct InAnonymous::(anonymous at {{.+}})' not at the end of a struct or class is a GNU extension}}
94 struct FlexibleArrayMem a
;
98 struct InAnonymousFollowedByAnon
{
99 struct { // expected-warning-re {{field '' with variable sized type 'struct InAnonymousFollowedByAnon::(anonymous at {{.+}})' not at the end of a struct or class is a GNU extension}}
101 struct FlexibleArrayMem a
;
108 // This is the behavior in C++ as well, so making sure we reproduce it here.
109 struct InAnonymousFollowedByEmpty
{
110 struct FlexibleArrayMem a
; // expected-warning {{field 'a' with variable sized type 'struct FlexibleArrayMem' not at the end of a struct or class is a GNU extension}}