2018-06-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / typeof-2.c
blob21ef5b0b865e661de8a4bb9364fdf9ccbea7c836
1 /* Test qualifier discard of typeof for atomic types. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11" } */
5 /* Check that the qualifiers are discarded for atomic types. */
7 extern int i;
9 extern int * p;
11 extern int _Atomic const ci;
12 extern __typeof (ci) i;
14 extern int _Atomic volatile vi;
15 extern __typeof (vi) i;
17 extern int * _Atomic restrict ri;
18 extern __typeof (ri) p;
20 void f(void)
22 __auto_type aci = ci;
23 int *paci = &aci;
25 __auto_type avi = vi;
26 int *pavi = &avi;
28 __auto_type ari = ri;
29 int **pari = &ari;
32 /* Check that the qualifiers are preserved for non-atomic types. */
34 extern int const j;
36 extern int volatile k;
38 extern int * restrict q;
40 extern int const nci;
41 extern __typeof (nci) j;
43 extern int volatile nvi;
44 extern __typeof (nvi) k;
46 extern int * restrict nri;
47 extern __typeof (nri) q;
49 void g(void)
51 __auto_type aci = nci;
52 int const *paci = &aci;
54 __auto_type avi = nvi;
55 int volatile *pavi = &avi;
57 __auto_type ari = nri;
58 int * restrict *pari = &ari;