Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / pr66322.c
blobeb1e9e4a2ed1f8dab730cd9c79e890b9cd2ae6f8
1 /* PR c/66322 */
2 /* { dg-do compile } */
4 #ifndef __cplusplus
5 # define bool _Bool
6 # define true 1
7 # define false 0
8 #endif
10 void
11 nowarn (bool b)
13 switch (b)
16 switch (b)
18 case true:
19 case false:
20 break;
23 switch (b)
25 case true:
26 break;
29 switch (b)
31 case true:
32 default:
33 break;
36 switch (b)
38 case false:
39 break;
42 switch (b)
44 case false:
45 default:
46 break;
49 switch (b)
51 default:
52 break;
55 switch (b)
57 case false ... true:
58 break;
61 switch (b)
63 case 1:
64 switch (b)
66 case true:
67 default:
68 break;
70 default:
71 break;
75 void
76 warn (bool b)
78 switch (b) /* { dg-warning "switch condition has" } */
80 case true:
81 case false:
82 default:
83 break;
86 switch (b) /* { dg-warning "switch condition has" } */
88 case false ... true:
89 default:
90 break;
94 void
95 warn2 (int n)
97 switch (n == 2) /* { dg-warning "switch condition has" } */
99 case 0 ... 2: /* { dg-warning "upper value" "" { target c++ } } */
100 default:
101 break;
104 switch (n == 2) /* { dg-warning "switch condition has" } */
106 case 1 ... 10: /* { dg-warning "upper value" "" { target c++ } } */
107 default:
108 break;
111 switch (n == 2) /* { dg-warning "switch condition has" } */
113 case 2: /* { dg-warning "case label" "" { target c++ } } */
114 break;
117 switch (n == 2) /* { dg-warning "switch condition has" } */
119 case 0:
120 case 1:
121 case -1: /* { dg-warning "case label" "" { target c++ } } */
122 break;
125 switch (n == 2) /* { dg-warning "switch condition has" } */
127 case -1 ... 1: /* { dg-warning "lower value" "" { target c++ } } */
128 break;
131 switch (n == 2) /* { dg-warning "switch condition has" } */
133 case -1 ... 0: /* { dg-warning "lower value" "" { target c++ } } */
134 default:
135 break;
138 switch (n == 2) /* { dg-warning "switch condition has" } */
140 case -10 ... -1: /* { dg-warning "case label" "" { target c++ } } */
141 default:
142 break;