2 /* { dg-options "-Wint-in-bool-context" } */
3 /* { dg-do compile } */
5 enum truth
{ yes
, no
, maybe
};
9 if (a
> 0 && a
<= (b
== 1) ? 1 : 2) /* { dg-warning "boolean context" } */
12 if (a
> 0 && a
<= (b
== 2) ? 1 : 1) /* { dg-bogus "boolean context" } */
15 if (a
> 0 && a
<= (b
== 3) ? 0 : 2) /* { dg-warning "boolean context" } */
18 if (a
== b
? 0 : 0) /* { dg-bogus "boolean context" } */
21 if (a
== ((b
? 2|4 : 1) & 3 ? 0 : 2)) /* { dg-bogus "boolean context" } */
24 if (a
? 1 : 1+1) /* { dg-warning "boolean context" } */
27 if (b
? 1+1 : 1) /* { dg-warning "boolean context" } */
30 for (a
= 0; 1 << a
; a
++); /* { dg-warning "boolean context" } */
32 if (yes
|| no
|| maybe
) /* { dg-warning "boolean context" "" { target c++ } } */
35 if (yes
|| no
) /* { dg-bogus "boolean context" } */