aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/flex-array-error.c
blob: 89601e42daf66ed5cc8d7e97180ef83a27c2073d (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
struct s {
	int i;
	long f[];
	int j;
};

union u {
	int i;
	long f[];
};

// trigger the examination of the offending types
static int foo(struct s *s, union u *u)
{
	return    __builtin_offsetof(typeof(*s), i)
		+ __builtin_offsetof(typeof(*u), i);
}

/*
 * check-name: flex-array-error
 * check-known-to-fail
 *
 * check-error-start
flex-array-error.c:3:14: error: flexible array member 'f' is not last
flex-array-error.c:9:14: error: flexible array member 'f' in a union
 * check-error-end
 */