Home | History | Annotate | Line # | Download | only in lint1
msg_108.c revision 1.4
      1 /*	$NetBSD: msg_108.c,v 1.4 2021/01/31 11:12:07 rillig Exp $	*/
      2 # 3 "msg_108.c"
      3 
      4 // Test for message: operand of '%s' has incompatible type (%s != %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