Home | History | Annotate | Line # | Download | only in lint1
msg_108.c revision 1.7
      1  1.7  rillig /*	$NetBSD: msg_108.c,v 1.7 2022/06/21 21:18:30 rillig Exp $	*/
      2  1.1  rillig # 3 "msg_108.c"
      3  1.1  rillig 
      4  1.7  rillig // Test for message: operand of '%s' has invalid type '%s' [108]
      5  1.1  rillig 
      6  1.3  rillig /*
      7  1.3  rillig  * Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
      8  1.3  rillig  * (an absurd idea, by the way), resulted in an internal error because the
      9  1.3  rillig  * message 108 had two operands, the second of which was always NOTSPEC, as
     10  1.3  rillig  * could be expected for a unary operator.
     11  1.3  rillig  *
     12  1.7  rillig  * Since an error "invalid type 'none'" doesn't make sense, lint rather chose
     13  1.7  rillig  * to crash than to generate such an error.
     14  1.3  rillig  */
     15  1.2  rillig void
     16  1.3  rillig complement_of_a_struct(void)
     17  1.2  rillig {
     18  1.3  rillig 	struct s {
     19  1.3  rillig 		int member;
     20  1.3  rillig 	} s = {
     21  1.3  rillig 	    0
     22  1.3  rillig 	};
     23  1.2  rillig 
     24  1.7  rillig 	/* expect+1: error: operand of '~' has invalid type 'struct s' [108] */
     25  1.6  rillig 	s = ~s;
     26  1.2  rillig }
     27