1 /* Test qualification of components of qualified structures or unions:
2 should have qualifiers from both the component and the structure or
3 union. Bug 27697 from Frank Victor Fischer. */
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
5 /* { dg-do compile } */
6 /* { dg-options "" } */
45 v1.d = 0; /* { dg-error "assignment of read-only" } */
46 v1.e[0] = 0; /* { dg-error "assignment of read-only" } */
47 *v1.e = 0; /* { dg-error "assignment of read-only" } */
48 v1.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
49 *v1.f[0] = 0; /* { dg-error "assignment of read-only" } */
50 **v1.f = 0; /* { dg-error "assignment of read-only" } */
58 v2->d = 0; /* { dg-error "assignment of read-only" } */
59 v2->e[0] = 0; /* { dg-error "assignment of read-only" } */
60 *v2->e = 0; /* { dg-error "assignment of read-only" } */
61 v2->f[0][0] = 0; /* { dg-error "assignment of read-only" } */
62 *v2->f[0] = 0; /* { dg-error "assignment of read-only" } */
63 **v2->f = 0; /* { dg-error "assignment of read-only" } */
65 v3->a = 0; /* { dg-error "assignment of read-only" } */
66 v3->b[0] = 0; /* { dg-error "assignment of read-only" } */
67 *v3->b = 0; /* { dg-error "assignment of read-only" } */
68 v3->c[0][0] = 0; /* { dg-error "assignment of read-only" } */
69 *v3->c[0] = 0; /* { dg-error "assignment of read-only" } */
70 **v3->c = 0; /* { dg-error "assignment of read-only" } */
71 v3->d = 0; /* { dg-error "assignment of read-only" } */
72 v3->e[0] = 0; /* { dg-error "assignment of read-only" } */
73 *v3->e = 0; /* { dg-error "assignment of read-only" } */
74 v3->f[0][0] = 0; /* { dg-error "assignment of read-only" } */
75 *v3->f[0] = 0; /* { dg-error "assignment of read-only" } */
76 **v3->f = 0; /* { dg-error "assignment of read-only" } */
78 v4.a = 0; /* { dg-error "assignment of read-only" } */
79 v4.b[0] = 0; /* { dg-error "assignment of read-only" } */
80 *v4.b = 0; /* { dg-error "assignment of read-only" } */
81 v4.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
82 *v4.c[0] = 0; /* { dg-error "assignment of read-only" } */
83 **v4.c = 0; /* { dg-error "assignment of read-only" } */
84 v4.d = 0; /* { dg-error "assignment of read-only" } */
85 v4.e[0] = 0; /* { dg-error "assignment of read-only" } */
86 *v4.e = 0; /* { dg-error "assignment of read-only" } */
87 v4.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
88 *v4.f[0] = 0; /* { dg-error "assignment of read-only" } */
89 **v4.f = 0; /* { dg-error "assignment of read-only" } */
91 v5.x.a = 0; /* { dg-error "assignment of read-only" } */
92 v5.x.b[0] = 0; /* { dg-error "assignment of read-only" } */
93 *v5.x.b = 0; /* { dg-error "assignment of read-only" } */
94 v5.x.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
95 *v5.x.c[0] = 0; /* { dg-error "assignment of read-only" } */
96 **v5.x.c = 0; /* { dg-error "assignment of read-only" } */
97 v5.x.d = 0; /* { dg-error "assignment of read-only" } */
98 v5.x.e[0] = 0; /* { dg-error "assignment of read-only" } */
99 *v5.x.e = 0; /* { dg-error "assignment of read-only" } */
100 v5.x.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
101 *v5.x.f[0] = 0; /* { dg-error "assignment of read-only" } */
102 **v5.x.f = 0; /* { dg-error "assignment of read-only" } */
111 int (*c)[2][3] = &v1.c;
113 const int (*ff)[3] = v1.c; /* { dg-warning "initialization from incompatible pointer type" } */
118 ff = v1.c; /* { dg-warning "assignment from incompatible pointer type" } */
121 const int *d = &v1.d;
122 const int (*e)[1] = &v1.e;
123 const int (*f)[2][3] = &v1.f;
124 const int (*ff)[3] = v1.f;
125 int (*cc)[3] = v1.f; /* { dg-warning "initialization from incompatible pointer type" } */
130 cc = v1.f; /* { dg-warning "assignment from incompatible pointer type" } */
135 int (*b)[1] = &v2->b;
136 int (*c)[2][3] = &v2->c;
137 int (*cc)[3] = v2->c;
138 const int (*ff)[3] = v2->c; /* { dg-warning "initialization from incompatible pointer type" } */
143 ff = v2->c; /* { dg-warning "assignment from incompatible pointer type" } */
146 const int *d = &v2->d;
147 const int (*e)[1] = &v2->e;
148 const int (*f)[2][3] = &v2->f;
149 const int (*ff)[3] = v2->f;
150 int (*cc)[3] = v2->f; /* { dg-warning "initialization from incompatible pointer type" } */
155 cc = v2->f; /* { dg-warning "assignment from incompatible pointer type" } */
159 const int *d = &v3->a;
160 const int (*e)[1] = &v3->b;
161 const int (*f)[2][3] = &v3->c;
162 const int (*ff)[3] = v3->c;
163 int (*cc)[3] = v3->c; /* { dg-warning "initialization from incompatible pointer type" } */
168 cc = v3->c; /* { dg-warning "assignment from incompatible pointer type" } */
171 const int *d = &v3->d;
172 const int (*e)[1] = &v3->e;
173 const int (*f)[2][3] = &v3->f;
174 const int (*ff)[3] = v3->f;
175 int (*cc)[3] = v3->f; /* { dg-warning "initialization from incompatible pointer type" } */
180 cc = v3->f; /* { dg-warning "assignment from incompatible pointer type" } */
184 const int *d = &v4.a;
185 const int (*e)[1] = &v4.b;
186 const int (*f)[2][3] = &v4.c;
187 const int (*ff)[3] = v4.c;
188 int (*cc)[3] = v4.c; /* { dg-warning "initialization from incompatible pointer type" } */
193 cc = v4.c; /* { dg-warning "assignment from incompatible pointer type" } */
196 const int *d = &v4.d;
197 const int (*e)[1] = &v4.e;
198 const int (*f)[2][3] = &v4.f;
199 const int (*ff)[3] = v4.f;
200 int (*cc)[3] = v4.f; /* { dg-warning "initialization from incompatible pointer type" } */
205 cc = v4.f; /* { dg-warning "assignment from incompatible pointer type" } */
209 const int *d = &v5.x.a;
210 const int (*e)[1] = &v5.x.b;
211 const int (*f)[2][3] = &v5.x.c;
212 const int (*ff)[3] = v5.x.c;
213 int (*cc)[3] = v5.x.c; /* { dg-warning "initialization from incompatible pointer type" } */
218 cc = v5.x.c; /* { dg-warning "assignment from incompatible pointer type" } */
221 const int *d = &v5.x.d;
222 const int (*e)[1] = &v5.x.e;
223 const int (*f)[2][3] = &v5.x.f;
224 const int (*ff)[3] = v5.x.f;
225 int (*cc)[3] = v5.x.f; /* { dg-warning "initialization from incompatible pointer type" } */
230 cc = v5.x.f; /* { dg-warning "assignment from incompatible pointer type" } */