1 // RUN: %clang_cc1 -fsyntax-only -verify %s
24 void test_unqual_references(struct X x
, const struct X xc
) {
25 // expected-note@-1 3{{variable 'xc' declared const here}}
30 x
.f3
= 0; // expected-error{{no member named 'f3'}}
33 xc
.d
= 0.0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
34 xc
.f
= 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
35 xc
.a
= 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
40 int x
; // expected-note{{previous declaration is here}}
41 struct y
{ }; // expected-warning{{declaration does not declare anything}}
44 int x
; // expected-error{{member of anonymous union redeclares 'x'}}
46 double z
; // expected-note{{previous declaration is here}}
47 double zz
; // expected-note{{previous declaration is here}}
50 int z
; // expected-error{{duplicate member 'z'}}
51 void zz(void); // expected-error{{duplicate member 'zz'}}
54 union { // expected-warning{{declaration does not declare anything}}
59 static union { // expected-warning{{declaration does not declare anything}}
65 int_val2
= 0; // expected-error{{use of undeclared identifier}}
66 float_val2
= 0.0; // expected-error{{use of undeclared identifier}}
70 union { // expected-warning{{declaration does not declare anything}}
74 i
= 0; // expected-error{{use of undeclared identifier}}
75 f2
= 0.0; // expected-error{{use of undeclared identifier}}
78 struct s0
{ union { int f0
; }; };
80 typedef struct { }; // expected-warning{{typedef requires a name}}
84 int f0
; // expected-note{{previous declaration is here}}
86 int f0
; // expected-error{{member of anonymous union redeclares 'f0'}}
91 struct {}; // expected-warning{{declaration does not declare anything}}
96 } // expected-warning{{expected ';' at end of declaration list}}
97 }; // expected-error{{expected member name or ';' after declaration specifiers}}
99 // Make sure we don't a.k.a. anonymous structs.
103 int tmp
= (a_struct
) { .x
= 0 }; // expected-error {{initializing 'int' with an expression of incompatible type 'a_struct'}}
105 // This example comes out of the C11 standard; make sure we don't accidentally reject it.
113 struct { int A
__attribute__((deprecated
)); }; // expected-note {{'A' has been explicitly marked deprecated here}}
116 void deprecated_anonymous_struct_member(void) {
118 s
.A
= 1; // expected-warning {{'A' is deprecated}}