1 /* $NetBSD: msg_108.c,v 1.9 2023/07/07 19:45:22 rillig Exp $ */
2 # 3 "msg_108.c"
3
4 // Test for message: operand of '%s' has invalid type '%s' [108]
5
6 /* lint1-extra-flags: -X 351 */
7
8 /*
9 * Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
10 * (an absurd idea, by the way), resulted in an internal error because the
11 * message 108 took two type operands, the second of which was not available
12 * for unary operators.
13 *
14 * Since an error "invalid type 'none'" doesn't make sense, lint rather chose
15 * to crash than to generate such an error.
16 */
17 void
complement_of_a_struct(void)18 complement_of_a_struct(void)
19 {
20 struct s {
21 int member;
22 } s = {
23 0
24 };
25
26 /* expect+1: error: operand of '~' has invalid type 'struct s' [108] */
27 s = ~s;
28 }
29