Add new test to verify that the array index, limit, and stride are
[official-gcc.git] / gcc / testsuite / gcc.dg / c1x-static-assert-1.c
blobbf7aa59451179c098e3dd24a45f69de1faa6bf60
1 /* Test C1X static assertions. Valid assertions. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c1x -pedantic-errors" } */
5 _Static_assert (1, "foo");
7 enum e { E0, E1 };
9 _Static_assert (E1, L"bar");
11 _Static_assert (-1, "foo" L"bar");
13 struct s
15 int a;
16 _Static_assert (3, "s");
17 int b;
20 union u
22 int i;
23 _Static_assert ((int)1.0, L"");
26 void
27 f (void)
29 int i;
30 i = 1;
31 _Static_assert (0 + 1, "f");
32 i = 2;
35 void
36 g (void)
38 int i = 0;
39 for (_Static_assert (1, ""); i < 10; i++)