1 /* $NetBSD: msg_277.c,v 1.9 2024/01/28 08:17:27 rillig Exp $ */
2 # 3 "msg_277.c"
3
4 // Test for message: initialization of '%s' with '%s' [277]
5
6 /* lint1-extra-flags: -e -X 351 */
7
8 enum E {
9 E1
10 };
11
12 void sink_enum(enum E);
13 void sink_int(int);
14
15 void
example(enum E e,int i)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 sink_enum(e2);
26 sink_enum(e3);
27 sink_int(i2);
28 sink_int(i3);
29
30 /* expect+1: warning: 'init_0' set but not used in function 'example' [191] */
31 enum E init_0 = 0;
32 /* expect+2: warning: initialization of 'enum E' with 'int' [277] */
33 /* expect+1: warning: 'init_1' set but not used in function 'example' [191] */
34 enum E init_1 = 1;
35 }
36