]>
Commit | Line | Data |
---|---|---|
38b7bc7f JM |
1 | /* Test __auto_type. Test correct uses. */ |
2 | /* { dg-do run } */ | |
3 | /* { dg-options "" } */ | |
e2acc079 | 4 | /* { dg-require-effective-target alloca } */ |
38b7bc7f JM |
5 | |
6 | extern void abort (void); | |
7 | extern void exit (int); | |
8 | ||
9 | __auto_type i = 1; | |
10 | extern int i; | |
11 | __auto_type c = (char) 1; | |
12 | extern char c; | |
13 | static __auto_type u = 10U; | |
14 | extern unsigned int u; | |
15 | const __auto_type ll = 1LL; | |
16 | extern const long long ll; | |
17 | ||
18 | int | |
19 | main (void) | |
20 | { | |
21 | if (i != 1 || c != 1 || u != 10U) | |
22 | abort (); | |
23 | __auto_type ai = i; | |
24 | int *aip = &ai; | |
25 | if (ai != 1) | |
26 | abort (); | |
27 | __auto_type p = (int (*) [++i]) 0; | |
28 | if (i != 2) | |
29 | abort (); | |
30 | if (sizeof (*p) != 2 * sizeof (int)) | |
31 | abort (); | |
32 | int vla[u][u]; | |
33 | int (*vp)[u] = &vla[0]; | |
34 | __auto_type vpp = ++vp; | |
35 | if (vp != &vla[1]) | |
36 | abort (); | |
37 | exit (0); | |
38 | } |