xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_244.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: msg_244.c,v 1.3 2022/06/16 21:24:41 rillig Exp $	*/
2 # 3 "msg_244.c"
3 
4 // Test for message: illegal structure pointer combination [244]
5 
6 struct a {
7 	int member;
8 };
9 
10 struct b {
11 	int member;
12 };
13 
14 int
15 diff(struct a *a, struct b *b)
16 {
17 	/* expect+1: error: illegal pointer subtraction [116] */
18 	return a - b;
19 }
20 
21 _Bool
22 lt(struct a *a, struct b *b)
23 {
24 	/* expect+1: warning: incompatible structure pointers: 'pointer to struct a' '<' 'pointer to struct b' [245] */
25 	return a < b;
26 }
27 
28 struct a *
29 ret(struct b *b)
30 {
31 	/* expect+1: warning: illegal structure pointer combination [244] */
32 	return b;
33 }
34