| 1 |
/* testing the correct usage of attribute strict_flex_array. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
|
| 5 |
|
| 6 |
int x __attribute__ ((strict_flex_array (1))); /* { dg-error "'strict_flex_array' attribute may not be specified for 'x'" } */ |
| 7 |
|
| 8 |
struct trailing { |
| 9 |
int a; |
| 10 |
int c __attribute ((strict_flex_array)); /* { dg-error "wrong number of arguments specified for 'strict_flex_array' attribute" } */ |
| 11 |
}; |
| 12 |
|
| 13 |
struct trailing_1 { |
| 14 |
int a; |
| 15 |
int b; |
| 16 |
int c __attribute ((strict_flex_array (2))); /* { dg-error "'strict_flex_array' attribute may not be specified for a non-array field" } */ |
| 17 |
}; |
| 18 |
|
| 19 |
extern int d; |
| 20 |
|
| 21 |
struct trailing_array_2 { |
| 22 |
int a; |
| 23 |
int b; |
| 24 |
int c[1] __attribute ((strict_flex_array (d))); /* { dg-error "'strict_flex_array' attribute argument not an integer" } */ |
| 25 |
}; |
| 26 |
|
| 27 |
struct trailing_array_3 { |
| 28 |
int a; |
| 29 |
int b; |
| 30 |
int c[0] __attribute ((strict_flex_array (5))); /* { dg-error "'strict_flex_array' attribute argument '5' is not an integer constant between 0 and 3" } */ |
| 31 |
}; |