| 1 |
/* Test comparisons of pointers to complete and incomplete types are |
| 2 |
diagnosed in C11 mode with -Wc99-c11-compat. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-std=c11 -pedantic-errors -Wc99-c11-compat" } */ |
| 5 |
|
| 6 |
int |
| 7 |
f (int (*p)[], int (*q)[3]) |
| 8 |
{ |
| 9 |
return p < q; /* { dg-warning "complete and incomplete" } */ |
| 10 |
} |
| 11 |
|
| 12 |
int |
| 13 |
f2 (int (*p)[], int (*q)[3]) |
| 14 |
{ |
| 15 |
return p <= q; /* { dg-warning "complete and incomplete" } */ |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
f3 (int (*p)[], int (*q)[3]) |
| 20 |
{ |
| 21 |
return p > q; /* { dg-warning "complete and incomplete" } */ |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
f4 (int (*p)[], int (*q)[3]) |
| 26 |
{ |
| 27 |
return p >= q; /* { dg-warning "complete and incomplete" } */ |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
g (int (*p)[], int (*q)[3]) |
| 32 |
{ |
| 33 |
return q < p; /* { dg-warning "complete and incomplete" } */ |
| 34 |
} |
| 35 |
|
| 36 |
int |
| 37 |
g2 (int (*p)[], int (*q)[3]) |
| 38 |
{ |
| 39 |
return q <= p; /* { dg-warning "complete and incomplete" } */ |
| 40 |
} |
| 41 |
|
| 42 |
int |
| 43 |
g3 (int (*p)[], int (*q)[3]) |
| 44 |
{ |
| 45 |
return q > p; /* { dg-warning "complete and incomplete" } */ |
| 46 |
} |
| 47 |
|
| 48 |
int |
| 49 |
g4 (int (*p)[], int (*q)[3]) |
| 50 |
{ |
| 51 |
return q >= p; /* { dg-warning "complete and incomplete" } */ |
| 52 |
} |