| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wenum-compare" } */ |
| 3 |
enum E1 { A, B, C }; |
| 4 |
enum E2 { D, E, F }; |
| 5 |
extern void f2 (); |
| 6 |
void |
| 7 |
f1 () |
| 8 |
{ |
| 9 |
int a = A; |
| 10 |
int d = D; |
| 11 |
enum E1 e1 = A; |
| 12 |
enum E2 e2 = D; |
| 13 |
if (A > D) /* { dg-warning "comparison between .enum E1. and .enum E2." } */ |
| 14 |
f2 (); |
| 15 |
if (e1 > e2) /* { dg-warning "comparison between .enum E1. and .enum E2." } */ |
| 16 |
f2 (); |
| 17 |
if (e1 > e2 + 1) |
| 18 |
f2 (); |
| 19 |
if (A > 0) |
| 20 |
f2 (); |
| 21 |
if (e1 > 0) |
| 22 |
f2 (); |
| 23 |
if (A + D > 0) |
| 24 |
f2 (); |
| 25 |
if (e1 > 0) |
| 26 |
f2 (); |
| 27 |
if (A + D > 0) |
| 28 |
f2 (); |
| 29 |
if ((int) A > D) |
| 30 |
f2 (); |
| 31 |
if ((int) e1 > e2) |
| 32 |
f2 (); |
| 33 |
} |