xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_179.c (revision b2baa50111d645353fa30b4deab0f79d93650c8c)
1 /*	$NetBSD: msg_179.c,v 1.5 2023/03/28 14:44:35 rillig Exp $	*/
2 # 3 "msg_179.c"
3 
4 // Test for message: cannot initialize struct/union with no named member [179]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 struct {
9 	unsigned int :0;
10 } no_named_member = {
11 	/* expect-1: error: cannot initialize struct/union with no named member [179] */
12 	/* no named member, therefore no initializer expression */
13 };
14 
15 struct {
16 	/* no members */
17 } empty = {
18 	/* expect-1: error: cannot initialize struct/union with no named member [179] */
19 	/* no initializer expressions */
20 };
21 
22 struct {
23 	unsigned int: 0;
24 } no_named_member_init = {
25 	/* expect-1: error: cannot initialize struct/union with no named member [179] */
26 	3,
27 };
28