1*c85f09ccSJohn Levon enum good { G, };
2*c85f09ccSJohn Levon enum bad  { B, };
3*c85f09ccSJohn Levon enum good g;
4*c85f09ccSJohn Levon 
compat_int(void)5*c85f09ccSJohn Levon enum good compat_int(void) { return 1; }
6*c85f09ccSJohn Levon 
7*c85f09ccSJohn Levon void parg(enum good);
8*c85f09ccSJohn Levon void parg(enum bad);
9*c85f09ccSJohn Levon 
10*c85f09ccSJohn Levon void farg(enum good a);
farg(enum bad a)11*c85f09ccSJohn Levon void farg(enum bad  a) { }
12*c85f09ccSJohn Levon 
13*c85f09ccSJohn Levon enum good pret(void);
14*c85f09ccSJohn Levon enum bad  pret(void);
15*c85f09ccSJohn Levon 
16*c85f09ccSJohn Levon enum good fret(void);
fret(void)17*c85f09ccSJohn Levon enum bad  fret(void) { return 0; }
18*c85f09ccSJohn Levon 
19*c85f09ccSJohn Levon 
20*c85f09ccSJohn Levon enum good *ptr;
21*c85f09ccSJohn Levon enum bad  *ptr;
22*c85f09ccSJohn Levon 
23*c85f09ccSJohn Levon enum good *gptr = &g;
24*c85f09ccSJohn Levon enum bad  *bptr = &g;
25*c85f09ccSJohn Levon 
26*c85f09ccSJohn Levon /*
27*c85f09ccSJohn Levon  * check-name: enum-typecheck
28*c85f09ccSJohn Levon  * check-command: sparse -Wno-decl $file
29*c85f09ccSJohn Levon  * check-known-to-fail
30*c85f09ccSJohn Levon  *
31*c85f09ccSJohn Levon  * check-error-start
32*c85f09ccSJohn Levon enum-typecheck.c:8:6: error: symbol 'parg' redeclared with different type
33*c85f09ccSJohn Levon enum-typecheck.c:11:6: error: symbol 'farg' redeclared with different type
34*c85f09ccSJohn Levon enum-typecheck.c:14:11: error: symbol 'pret' redeclared with different type
35*c85f09ccSJohn Levon enum-typecheck.c:17:11: error: symbol 'fret' redeclared with different type
36*c85f09ccSJohn Levon enum-typecheck.c:21:12: error: symbol 'ptr' redeclared with different type
37*c85f09ccSJohn Levon enum-typecheck.c:24:20: warning: incorrect type in initializer (different type sizes)
38*c85f09ccSJohn Levon  * check-error-end
39*c85f09ccSJohn Levon  */
40