PR c++/82069 - ICE with lambda in template
[official-gcc.git] / gcc / testsuite / gcc.dg / vla-16.c
blob05e751af7a56ee80cca496b1bc3c7c7268ef7bc4
1 /* Test for modifying and taking addresses of compound literals whose
2 variably modified types involve typeof. */
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do run } */
5 /* { dg-options "-std=gnu99" } */
7 #include <stdarg.h>
9 extern void exit (int);
10 extern void abort (void);
12 int a[1];
14 void
15 f1 (void)
17 int i = 0;
18 int (**p)[1] = &(typeof (++i, (int (*)[i])a)){&a};
19 if (*p != &a)
20 abort ();
21 if (i != 1)
22 abort ();
25 void
26 f2 (void)
28 int i = 0;
29 (typeof (++i, (int (*)[i])a)){&a} = 0;
30 if (i != 1)
31 abort ();
34 void
35 f3 (void)
37 int i = 0;
38 (typeof (++i, (int (*)[i])a)){&a} += 1;
39 if (i != 1)
40 abort ();
43 void
44 f4 (void)
46 int i = 0;
47 --(typeof (++i, (int (*)[i])a)){&a + 1};
48 if (i != 1)
49 abort ();
52 void
53 f5 (void)
55 int i = 0;
56 (typeof (++i, (int (*)[i])a)){&a}++;
57 if (i != 1)
58 abort ();
61 int
62 main (void)
64 f1 ();
65 f2 ();
66 f3 ();
67 f4 ();
68 f5 ();
69 exit (0);