| 1 |
/* Verify that combinations of array type qualifiers render correctly. |
| 2 |
{ dg-do compile } |
| 3 |
{ dg-options "-Warray-parameter" } */ |
| 4 |
|
| 5 |
void fatm (int[_Atomic 1]); // { dg-message "previously declared as 'int\\\[_Atomic 1]" } |
| 6 |
void fatm (int[_Atomic 2]); // { dg-warning "argument 1 of type 'int\\\[_Atomic 2]' with mismatched bound" } |
| 7 |
|
| 8 |
|
| 9 |
void fcst (int[const 2]); // { dg-message "previously declared as 'int\\\[const 2]" } |
| 10 |
void fcst (int[const 3]); // { dg-warning "argument 1 of type 'int\\\[const 3]' with mismatched bound" } |
| 11 |
|
| 12 |
|
| 13 |
void frst (int[restrict 3]); // { dg-message "previously declared as 'int\\\[restrict 3]" } |
| 14 |
void frst (int[restrict 4]); // { dg-warning "argument 1 of type 'int\\\[restrict 4]' with mismatched bound" } |
| 15 |
|
| 16 |
void fvol (int[volatile 4]); // { dg-message "previously declared as 'int\\\[volatile 4]" } |
| 17 |
void fvol (int[volatile 5]); // { dg-warning "argument 1 of type 'int\\\[volatile 5]' with mismatched bound" } |
| 18 |
|
| 19 |
|
| 20 |
void fcr (int[const restrict 1]); // { dg-message "previously declared as 'int\\\[\(const restrict|restrict const\) 1]" } |
| 21 |
void fcr (int[restrict volatile 2]); // { dg-warning "argument 1 of type 'int\\\[\(restrict volatile|volatile restrict\) 2]' with mismatched bound" } |
| 22 |
void fcr (int[const restrict volatile 3]); // { dg-warning "argument 1 of type 'int\\\[const volatile restrict 3]' with mismatched bound" } |
| 23 |
|
| 24 |
|
| 25 |
extern int n; |
| 26 |
|
| 27 |
void fcx_n (int [const 1][n]); // { dg-message "previously declared as 'int\\\[const 1]\\\[n]'" "note" } |
| 28 |
void fcx_n (int [restrict 2][n]); // { dg-warning "argument 1 of type 'int\\\[restrict 2]\\\[n]' with mismatched bound" } |
| 29 |
|
| 30 |
|
| 31 |
extern int n1, n2; |
| 32 |
|
| 33 |
/* The mismatch in the array bound should be diagnosed but the mismatch |
| 34 |
in the VLA should not be without -Wvla-parameter. */ |
| 35 |
void fc3_n1 (int [const 3][n1]); // { dg-message "previously declared as 'int\\\[const 3]\\\[n1]'" "note" } |
| 36 |
void fc3_n1 (int [const 5][n2]); // { dg-warning "argument 1 of type 'int\\\[const 5]\\\[n2]' with mismatched bound" } |