Home | History | Annotate | Line # | Download | only in lint1
msg_171.c revision 1.4
      1 /*	$NetBSD: msg_171.c,v 1.4 2021/03/22 15:29:43 rillig Exp $	*/
      2 # 3 "msg_171.c"
      3 
      4 // Test for message: cannot assign to '%s' from '%s' [171]
      5 
      6 struct s {
      7 	int member;
      8 };
      9 
     10 /*ARGSUSED*/
     11 void
     12 example(int i, void *vp, struct s *s)
     13 {
     14 	i = *s;			/* expect: 171 */
     15 	*s = i;			/* expect: 171 */
     16 
     17 	vp = *s;		/* expect: 171 */
     18 	*s = vp;		/* expect: 171 */
     19 }
     20 
     21 /*
     22  * C99 6.5.2.5 says that a compound literal evaluates to an unnamed object
     23  * with automatic storage duration, like any normal named object.  It is an
     24  * lvalue, which means that it is possible to take the address of the object.
     25  * Seen in external/mpl/bind/dist/lib/dns/rbtdb.c, update_rrsetstats.
     26  */
     27 void
     28 pointer_to_compound_literal(void)
     29 {
     30 	struct point {
     31 		int x;
     32 		int y;
     33 	};
     34 	struct point *p = &(struct point){
     35 	    12, 5,
     36 	};			/* expect: 171 *//*FIXME*/
     37 }
     38