xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_108.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: msg_108.c,v 1.5 2021/02/28 12:40:00 rillig Exp $	*/
2 # 3 "msg_108.c"
3 
4 // Test for message: operand of '%s' has invalid type (%s) [108]
5 
6 /*
7  * Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
8  * (an absurd idea, by the way), resulted in an internal error because the
9  * message 108 had two operands, the second of which was always NOTSPEC, as
10  * could be expected for a unary operator.
11  *
12  * Since an error "invalid type (none)" doesn't make sense, lint rather
13  * chooses to crash than to generate such an error.
14  */
15 void
16 complement_of_a_struct(void)
17 {
18 	struct s {
19 		int member;
20 	} s = {
21 	    0
22 	};
23 
24 	s = ~s;			/* expect: 108 */
25 }
26