xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_242.c (revision 122b5006ee1bd67145794b4cde92f4fe4781a5ec)
1 /*	$NetBSD: msg_242.c,v 1.4 2021/08/14 12:46:24 rillig Exp $	*/
2 # 3 "msg_242.c"
3 
4 // Test for message: combination of '%s' and '%s', op %s [242]
5 
6 /* lint1-extra-flags: -e */
7 
8 enum E {
9 	E1
10 };
11 
12 void sink_enum(enum E);
13 void sink_int(int);
14 
15 void
16 example(enum E e, int i)
17 {
18 	enum E e2 = e;
19 	/* expect+1: warning: initialization of 'enum E' with 'int' [277] */
20 	enum E e3 = i;
21 	/* expect+1: warning: initialization of 'int' with 'enum E' [277] */
22 	int i2 = e;
23 	int i3 = i;
24 
25 	/* expect+1: warning: combination of 'enum E' and 'int', op = [242] */
26 	e3 = i;
27 	/* expect+1: warning: combination of 'int' and 'enum E', op = [242] */
28 	i2 = e;
29 
30 	sink_enum(e2);
31 	sink_enum(e3);
32 	sink_int(i2);
33 	sink_int(i3);
34 }
35