2 /* { dg-do compile } */
3 /* { dg-options "-Wno-div-by-zero" } */
5 /* Accept these unless -pedantic-errors/-Werror. */
11 int a6
= (-1 << 2) ^ (1 >> 1);
12 int a7
= 0 || (-1 << 1);
13 int a8
= 0 ? 2 : (-1 << 1);
14 int a9
= 1 && -1 << 0;
17 /* Don't accept these. */
18 int b1
= 1 / 0; /* { dg-error "initializer element is not constant" } */
19 int b2
= 1 / (1 / 0); /* { dg-error "initializer element is not constant" } */
20 int b3
= 0 ? 2 : 1 / 0; /* { dg-error "initializer element is not constant" } */
21 int b4
= 0 || 1 / 0; /* { dg-error "initializer element is not constant" } */
22 int b5
= 0 * (1 / 0); /* { dg-error "initializer element is not constant" } */
23 int b6
= 1 * (1 / 0); /* { dg-error "initializer element is not constant" } */
24 int b7
= (1 / 0) * 0; /* { dg-error "initializer element is not constant" } */
25 int b8
= (1 / 0) * 1; /* { dg-error "initializer element is not constant" } */
26 int b9
= 1 && 1 / 0; /* { dg-error "initializer element is not constant" } */
27 int b10
= !(1 / 0); /* { dg-error "initializer element is not constant" } */
28 int c1
= 1 % 0; /* { dg-error "initializer element is not constant" } */
29 int c2
= 1 / (1 % 0); /* { dg-error "initializer element is not constant" } */
30 int c3
= 0 ? 2 : 1 % 0; /* { dg-error "initializer element is not constant" } */
31 int c4
= 0 || 1 % 0; /* { dg-error "initializer element is not constant" } */
32 int c5
= 0 * (1 % 0); /* { dg-error "initializer element is not constant" } */
33 int c6
= 1 * (1 % 0); /* { dg-error "initializer element is not constant" } */
34 int c7
= (1 % 0) * 0; /* { dg-error "initializer element is not constant" } */
35 int c8
= (1 % 0) * 1; /* { dg-error "initializer element is not constant" } */
36 int c9
= 1 && 1 % 0; /* { dg-error "initializer element is not constant" } */
37 int c10
= !(1 % 0); /* { dg-error "initializer element is not constant" } */