msg_108.c revision 1.7 1 /* $NetBSD: msg_108.c,v 1.7 2022/06/21 21:18:30 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 chose
13 * 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 /* expect+1: error: operand of '~' has invalid type 'struct s' [108] */
25 s = ~s;
26 }
27