i386: Allow all register_operand SUBREGs in x86_ternlog_idx.
[official-gcc.git] / gcc / testsuite / gcc.dg / typeof-2.c
blob68f91c6c361cc976246e845f985ab387d29f29e3
1 /* Test qualifier preservation of typeof and discarded for __auto_type. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11" } */
5 /* Check that the qualifiers are preserved for atomic types. */
7 extern int i;
9 extern int * p;
11 extern int _Atomic const ci;
12 extern __typeof (ci) ci;
14 extern int _Atomic volatile vi;
15 extern __typeof (vi) vi;
17 extern int * _Atomic restrict ri;
18 extern __typeof (ri) ri;
20 /* Check that the qualifiers are discarded for atomic types. */
22 void f(void)
24 __auto_type aci = ci;
25 int *paci = &aci;
27 __auto_type avi = vi;
28 int *pavi = &avi;
30 __auto_type ari = ri;
31 int **pari = &ari;
34 /* Check that the qualifiers are preserved for non-atomic types. */
36 extern int const j;
38 extern int volatile k;
40 extern int * restrict q;
42 extern int const nci;
43 extern __typeof (nci) j;
45 extern int volatile nvi;
46 extern __typeof (nvi) k;
48 extern int * restrict nri;
49 extern __typeof (nri) q;
51 /* Check that the qualifiers are discarded for non-atomic types. */
53 void g(void)
55 __auto_type aci = nci;
56 int *paci = &aci;
58 __auto_type avi = nvi;
59 int *pavi = &avi;
61 __auto_type ari = nri;
62 int **pari = &ari;