]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/pr66066-3.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / pr66066-3.c
CommitLineData
3aa3c9fc
MP
1/* PR c/66066 */
2/* { dg-do compile } */
3/* { dg-options "-Wno-div-by-zero -pedantic-errors" } */
4
5/* Accept these unless -pedantic-errors/-Werror. */
6int a1 = -1 << 0; /* { dg-error "initializer element is not a constant expression" } */
7int a2 = -1 << 0 | 0; /* { dg-error "initializer element is not a constant expression" } */
8int a3 = -1 << 0 & 1; /* { dg-error "initializer element is not a constant expression" } */
9int a4 = -1 << 2 ^ 1; /* { dg-error "initializer element is not a constant expression" } */
10int a5 = 4 & -1 << 2; /* { dg-error "initializer element is not a constant expression" } */
11int a6 = (-1 << 2) ^ (1 >> 1); /* { dg-error "initializer element is not a constant expression" } */
12int a7 = 0 || (-1 << 1); /* { dg-error "initializer element is not a constant expression" } */
13int a8 = 0 ? 2 : (-1 << 1); /* { dg-error "initializer element is not a constant expression" } */
14int a9 = 1 && -1 << 0; /* { dg-error "initializer element is not a constant expression" } */
15int a10 = !(-1 << 0); /* { dg-error "initializer element is not a constant expression" } */
16
17/* Don't accept these. */
18int b1 = 1 / 0; /* { dg-error "initializer element is not constant" } */
19int b2 = 1 / (1 / 0); /* { dg-error "initializer element is not constant" } */
20int b3 = 0 ? 2 : 1 / 0; /* { dg-error "initializer element is not constant" } */
21int b4 = 0 || 1 / 0; /* { dg-error "initializer element is not constant" } */
22int b5 = 0 * (1 / 0); /* { dg-error "initializer element is not constant" } */
23int b6 = 1 * (1 / 0); /* { dg-error "initializer element is not constant" } */
24int b7 = (1 / 0) * 0; /* { dg-error "initializer element is not constant" } */
25int b8 = (1 / 0) * 1; /* { dg-error "initializer element is not constant" } */
26int b9 = 1 && 1 / 0; /* { dg-error "initializer element is not constant" } */
27int b10 = !(1 / 0); /* { dg-error "initializer element is not constant" } */
28int c1 = 1 % 0; /* { dg-error "initializer element is not constant" } */
29int c2 = 1 / (1 % 0); /* { dg-error "initializer element is not constant" } */
30int c3 = 0 ? 2 : 1 % 0; /* { dg-error "initializer element is not constant" } */
31int c4 = 0 || 1 % 0; /* { dg-error "initializer element is not constant" } */
32int c5 = 0 * (1 % 0); /* { dg-error "initializer element is not constant" } */
33int c6 = 1 * (1 % 0); /* { dg-error "initializer element is not constant" } */
34int c7 = (1 % 0) * 0; /* { dg-error "initializer element is not constant" } */
35int c8 = (1 % 0) * 1; /* { dg-error "initializer element is not constant" } */
36int c9 = 1 && 1 % 0; /* { dg-error "initializer element is not constant" } */
37int c10 = !(1 % 0); /* { dg-error "initializer element is not constant" } */