1*1f5207b7SJohn Levon typedef unsigned short __attribute__((bitwise)) le16;
2*1f5207b7SJohn Levon struct s {
3*1f5207b7SJohn Levon 	int a:2;
4*1f5207b7SJohn Levon 	int b:2;
5*1f5207b7SJohn Levon 	int c:2;
6*1f5207b7SJohn Levon };
7*1f5207b7SJohn Levon 
fresi(le16 a)8*1f5207b7SJohn Levon static _Bool fresi(le16 a)     { return a; }
frese(le16 a)9*1f5207b7SJohn Levon static _Bool frese(le16 a)     { return (_Bool)a; }
fstsi(struct s a)10*1f5207b7SJohn Levon static _Bool fstsi(struct s a) { return a; }
fstse(struct s a)11*1f5207b7SJohn Levon static _Bool fstse(struct s a) { return (_Bool)a; }
12*1f5207b7SJohn Levon 
13*1f5207b7SJohn Levon /*
14*1f5207b7SJohn Levon  * check-name: bool-cast-bad.c
15*1f5207b7SJohn Levon  * check-command: sparse $file
16*1f5207b7SJohn Levon  *
17*1f5207b7SJohn Levon  * check-error-start
18*1f5207b7SJohn Levon bool-cast-bad.c:10:41: warning: incorrect type in return expression (different base types)
19*1f5207b7SJohn Levon bool-cast-bad.c:10:41:    expected bool
20*1f5207b7SJohn Levon bool-cast-bad.c:10:41:    got struct s a
21*1f5207b7SJohn Levon bool-cast-bad.c:11:42: warning: cast from non-scalar
22*1f5207b7SJohn Levon  * check-error-end
23*1f5207b7SJohn Levon  */
24