modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup
[official-gcc.git] / gcc / testsuite / gcc.dg / c23-auto-2.c
blob4318e9984c3deea1abf31bc0c6bc59197536ead8
1 /* Test C23 auto. Valid code, execution tests. Based on auto-type-1.c. */
2 /* { dg-do run } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4 /* { dg-require-effective-target alloca } */
6 extern void abort (void);
7 extern void exit (int);
9 auto i = 1;
10 extern int i;
11 auto c = (char) 1;
12 extern char c;
13 static auto u = 10U;
14 extern unsigned int u;
15 const auto ll = 1LL;
16 extern const long long ll;
18 int
19 main (void)
21 if (i != 1 || c != 1 || u != 10U)
22 abort ();
23 auto ai = i;
24 int *aip = &ai;
25 if (ai != 1)
26 abort ();
27 auto 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 vpp = ++vp;
35 if (vp != &vla[1])
36 abort ();
37 exit (0);