| 1 |
// Test that -Wsign-compare doesn't warn about |
| 2 |
// equality/non-equality comparisons with sizeof. |
| 3 |
// { dg-do compile } |
| 4 |
// { dg-options "-Wsign-compare" } |
| 5 |
|
| 6 |
int |
| 7 |
foo (int x) |
| 8 |
{ |
| 9 |
if (x != sizeof (sizeof (x))) // { dg-bogus "comparison between signed and unsigned integer expressions" } |
| 10 |
return 1; |
| 11 |
return 0; |
| 12 |
} |
| 13 |
|
| 14 |
int |
| 15 |
bar (int x) |
| 16 |
{ |
| 17 |
if (x == sizeof (sizeof (x)) + 1) // { dg-bogus "comparison between signed and unsigned integer expressions" } |
| 18 |
return 1; |
| 19 |
return 0; |
| 20 |
} |