aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/strict-flex-array-1.C
blob: 92fcffe081ff32d5e403fc2ee5a9160c4e47e21e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* testing the correct usage of attribute strict_flex_array.  */   
/* { dg-do compile } */
/* { dg-options "-O2" } */


int x __attribute__ ((strict_flex_array (1))); /* { dg-error "'strict_flex_array' attribute may not be specified for 'x'" } */

struct trailing {
    int a;
    int c __attribute ((strict_flex_array)); /* { dg-error "wrong number of arguments specified for 'strict_flex_array' attribute" } */
};

struct trailing_1 {
    int a;
    int b;
    int c __attribute ((strict_flex_array (2))); /* { dg-error "'strict_flex_array' attribute may not be specified for a non-array field" } */
};

extern int d;

struct trailing_array_2 {
    int a;
    int b;
    int c[1] __attribute ((strict_flex_array (d))); /* { dg-error "'strict_flex_array' attribute argument not an integer" } */
};

struct trailing_array_3 {
    int a;
    int b;
    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" } */
};