aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/flex-array-error.c
blob: 2b7e6953050c6868a8e30f3d47a6eff43e74dcdf (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
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-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
 */