1*c85f09ccSJohn Levon typedef	unsigned short		u16;
2*c85f09ccSJohn Levon typedef	unsigned int		u32;
3*c85f09ccSJohn Levon 
4*c85f09ccSJohn Levon union u {
5*c85f09ccSJohn Levon 	u32	a;
6*c85f09ccSJohn Levon 	u16	b;
7*c85f09ccSJohn Levon };
8*c85f09ccSJohn Levon 
9*c85f09ccSJohn Levon struct s {
10*c85f09ccSJohn Levon 	u32	a;
11*c85f09ccSJohn Levon 	u16	b;
12*c85f09ccSJohn Levon };
13*c85f09ccSJohn Levon 
14*c85f09ccSJohn Levon 
15*c85f09ccSJohn Levon void bar(u16, u32);
16*c85f09ccSJohn Levon void union_to_int(u16 val);
17*c85f09ccSJohn Levon void struct_to_int(u16 val);
18*c85f09ccSJohn Levon 
19*c85f09ccSJohn Levon 
union_to_int(u16 val)20*c85f09ccSJohn Levon void union_to_int(u16 val)
21*c85f09ccSJohn Levon {
22*c85f09ccSJohn Levon 	union u u;
23*c85f09ccSJohn Levon 
24*c85f09ccSJohn Levon 	u.b = val;
25*c85f09ccSJohn Levon 	bar(u.b, u);
26*c85f09ccSJohn Levon }
27*c85f09ccSJohn Levon 
struct_to_int(u16 val)28*c85f09ccSJohn Levon void struct_to_int(u16 val)
29*c85f09ccSJohn Levon {
30*c85f09ccSJohn Levon 	struct s s;
31*c85f09ccSJohn Levon 
32*c85f09ccSJohn Levon 	s.b = val;
33*c85f09ccSJohn Levon 	bar(s.b, s);
34*c85f09ccSJohn Levon }
35*c85f09ccSJohn Levon 
36*c85f09ccSJohn Levon /*
37*c85f09ccSJohn Levon  * check-name: cast-bad 00
38*c85f09ccSJohn Levon  *
39*c85f09ccSJohn Levon  * check-error-start
40*c85f09ccSJohn Levon cast-bad-00.c:25:18: warning: incorrect type in argument 2 (different base types)
41*c85f09ccSJohn Levon cast-bad-00.c:25:18:    expected unsigned int [usertype]
42*c85f09ccSJohn Levon cast-bad-00.c:25:18:    got union u [assigned] u
43*c85f09ccSJohn Levon cast-bad-00.c:33:18: warning: incorrect type in argument 2 (different base types)
44*c85f09ccSJohn Levon cast-bad-00.c:33:18:    expected unsigned int [usertype]
45*c85f09ccSJohn Levon cast-bad-00.c:33:18:    got struct s [assigned] s
46*c85f09ccSJohn Levon  * check-error-end
47*c85f09ccSJohn Levon  */
48