| 1 |
/* PR c/115290 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Warray-compare" } */ |
| 4 |
|
| 5 |
int a[32][32], b[32][32]; |
| 6 |
|
| 7 |
int |
| 8 |
foo (int x, int y) |
| 9 |
{ |
| 10 |
return (x ? a : b) == (y ? a : b); /* { dg-warning "comparison between two arrays" "" { target { c || c++23_down } } } */ |
| 11 |
/* { dg-error "comparison between two arrays" "" { target c++26 } .-1 } */ |
| 12 |
/* { dg-message "use '&\\\(\[^\n\r]*\\\)\\\[0\\\] == &\\\(\[^\n\r]*\\\)\\\[0\\\]' to compare the addresses" "" { target c } .-2 } */ |
| 13 |
/* { dg-message "use unary '\\\+' which decays operands to pointers or '&\\\(\[^\n\r]*\\\)\\\[0\\\] == &\\\(\[^\n\r]*\\\)\\\[0\\\]' to compare the addresses" "" { target c++ } .-3 } */ |
| 14 |
} |