9 } __attribute__((designated_init
));
19 } __attribute__((designated_init
));
21 static struct s1 s1_positional
= { 5, 10 };
22 static struct s1 s1_designated
= { .x
= 5, .y
= 10 };
23 static struct s2 s2_positional
= { 5, 10 };
24 static struct s2 s2_designated
= { .x
= 5, .y
= 10 };
25 static struct nest1 nest1_positional
= {
29 static struct nest1 nest1_designated_outer
= {
33 static struct nest1 nest1_designated_inner
= {
37 static struct nest1 nest1_designated_both
= {
38 .s1
= { .x
= 5, .y
= 10 },
39 .s2
= { .x
= 5, .y
= 10 },
41 static struct nest2 nest2_positional
= {
45 static struct nest2 nest2_designated_outer
= {
49 static struct nest2 nest2_designated_inner
= {
53 static struct nest2 nest2_designated_both
= {
54 .s1
= { .x
= 5, .y
= 10 },
55 .s2
= { .x
= 5, .y
= 10 },
61 } __attribute__((designated_init
))
62 anon_positional
= { 5, 10 },
63 anon_designated
= { .x
= 5, .y
= 10};
65 static struct s1 s1_array
[] = {
70 static struct s2 s2_array
[] = {
75 static struct s1
ret_s1_positional(void)
77 return ((struct s1
){ 5, 10 });
80 static struct s1
ret_s1_designated(void)
82 return ((struct s1
){ .x
= 5, .y
= 10 });
85 static struct s2
ret_s2_positional(void)
87 return ((struct s2
){ 5, 10 });
90 static struct s2
ret_s2_designated(void)
92 return ((struct s2
){ .x
= 5, .y
= 10 });
95 static struct nest1
ret_nest1_positional(void)
97 return ((struct nest1
){
103 static struct nest1
ret_nest1_designated_outer(void)
105 return ((struct nest1
){
111 static struct nest1
ret_nest1_designated_inner(void)
113 return ((struct nest1
){
119 static struct nest1
ret_nest1_designated_both(void)
121 return ((struct nest1
){
122 .s1
= { .x
= 5, .y
= 10 },
123 .s2
= { .x
= 5, .y
= 10 },
127 static struct nest2
ret_nest2_positional(void)
129 return ((struct nest2
){
135 static struct nest2
ret_nest2_designated_outer(void)
137 return ((struct nest2
){
143 static struct nest2
ret_nest2_designated_inner(void)
145 return ((struct nest2
){
151 static struct nest2
ret_nest2_designated_both(void)
153 return ((struct nest2
){
154 .s1
= { .x
= 5, .y
= 10 },
155 .s2
= { .x
= 5, .y
= 10 },
159 * check-name: designated_init attribute
162 designated-init.c:23:36: warning: in initializer for s2_positional: positional init of field in struct s2, declared with attribute designated_init
163 designated-init.c:23:39: warning: in initializer for s2_positional: positional init of field in struct s2, declared with attribute designated_init
164 designated-init.c:27:11: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
165 designated-init.c:27:14: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
166 designated-init.c:31:17: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
167 designated-init.c:31:20: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
168 designated-init.c:42:9: warning: in initializer for nest2_positional: positional init of field in struct nest2, declared with attribute designated_init
169 designated-init.c:43:9: warning: in initializer for nest2_positional: positional init of field in struct nest2, declared with attribute designated_init
170 designated-init.c:43:11: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
171 designated-init.c:43:14: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
172 designated-init.c:47:17: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
173 designated-init.c:47:20: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
174 designated-init.c:50:9: warning: in initializer for nest2_designated_inner: positional init of field in struct nest2, declared with attribute designated_init
175 designated-init.c:51:9: warning: in initializer for nest2_designated_inner: positional init of field in struct nest2, declared with attribute designated_init
176 designated-init.c:62:29: warning: in initializer for anon_positional: positional init of field in struct <noident>, declared with attribute designated_init
177 designated-init.c:62:32: warning: in initializer for anon_positional: positional init of field in struct <noident>, declared with attribute designated_init
178 designated-init.c:71:11: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
179 designated-init.c:71:14: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
180 designated-init.c:87:30: warning: positional init of field in struct s2, declared with attribute designated_init
181 designated-init.c:87:33: warning: positional init of field in struct s2, declared with attribute designated_init
182 designated-init.c:99:27: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
183 designated-init.c:99:30: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
184 designated-init.c:107:33: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
185 designated-init.c:107:36: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
186 designated-init.c:130:25: warning: positional init of field in struct nest2, declared with attribute designated_init
187 designated-init.c:131:25: warning: positional init of field in struct nest2, declared with attribute designated_init
188 designated-init.c:131:27: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
189 designated-init.c:131:30: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
190 designated-init.c:139:33: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
191 designated-init.c:139:36: warning: in initializer for s2: positional init of field in struct s2, declared with attribute designated_init
192 designated-init.c:146:25: warning: positional init of field in struct nest2, declared with attribute designated_init
193 designated-init.c:147:25: warning: positional init of field in struct nest2, declared with attribute designated_init