testsuite: Add more C2x tests
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / c2x-complit-1.c
1 /* Test storage duration of compound literals in parameter lists for C2x.  */
2 /* { dg-do run } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
4
5 extern void abort (void);
6 extern void exit (int);
7
8 int x;
9
10 void f (int a[(int) { x }]);
11
12 int *q;
13
14 int
15 fp (int *p)
16 {
17   q = p;
18   return 1;
19 }
20
21 void
22 g (int a, int b[fp ((int [2]) { a, a + 2 })])
23 {
24   if (q[0] != a || q[1] != a + 2)
25     abort ();
26 }
27
28 int
29 main (void)
30 {
31   int t[1] = { 0 };
32   g (1, t);
33   g (2, t);
34   exit (0);
35 }