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