xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_121.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: msg_121.c,v 1.6 2022/06/19 12:14:34 rillig Exp $	*/
2 # 3 "msg_121.c"
3 
4 // Test for message: negative shift [121]
5 
6 int
7 example(int x)
8 {
9 	/* expect+1: warning: negative shift [121] */
10 	return x << (3 - 5);
11 }
12 
13 void /*ARGSUSED*/
14 shift_by_double(int x, double amount)
15 {
16 	/*
17 	 * This is already caught by typeok_scalar, so it doesn't reach
18 	 * typeok_shift via typeok_op.
19 	 */
20 	/* expect+1: error: operands of '<<' have incompatible types 'int' and 'double' [107] */
21 	return x << amount;
22 }
23