summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/msg_145.c
blob: 400b6ece83ce487e9eeef1b4c18fb95593391cb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*	$NetBSD: msg_145.c,v 1.5 2023/07/07 19:45:22 rillig Exp $	*/
# 3 "msg_145.c"

// Test for message: cannot take size/alignment of bit-field [145]

/* lint1-extra-flags: -X 351 */

struct bits {
	unsigned one: 1;
	unsigned eight: 8;
};

unsigned long
sizeof_one(void)
{
	struct bits local_bits;

	/* expect+1: error: cannot take size/alignment of bit-field [145] */
	return sizeof(local_bits.one);
}

unsigned long
sizeof_eight(void)
{
	struct bits local_bits;

	/* expect+1: error: cannot take size/alignment of bit-field [145] */
	return sizeof(local_bits.eight);
}