aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-complit-1.c
blob: af92d4d0a9a9448c30cc56a49fa57ce66e4acb33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Test storage duration of compound literals in parameter lists for C2x.  */
/* { dg-do run } */
/* { dg-options "-std=c2x -pedantic-errors" } */

extern void abort (void);
extern void exit (int);

int x;

void f (int a[(int) { x }]);

int *q;

int
fp (int *p)
{
  q = p;
  return 1;
}

void
g (int a, int b[fp ((int [2]) { a, a + 2 })])
{
  if (q[0] != a || q[1] != a + 2)
    abort ();
}

int
main (void)
{
  int t[1] = { 0 };
  g (1, t);
  g (2, t);
  exit (0);
}