| 1 |
/* PR c++/62199 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wlogical-not-parentheses" } */ |
| 4 |
|
| 5 |
#ifndef __cplusplus |
| 6 |
# define bool _Bool |
| 7 |
#endif |
| 8 |
|
| 9 |
bool r; |
| 10 |
|
| 11 |
void |
| 12 |
foo (bool b) |
| 13 |
{ |
| 14 |
r = !b == 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 15 |
r = !b != 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 16 |
r = !b > 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 17 |
r = !b >= 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 18 |
r = !b < 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 19 |
r = !b <= 1; /* { dg-bogus "logical not is only applied to the left hand side of comparison" } */ |
| 20 |
} |