xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_211.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: msg_211.c,v 1.5 2022/06/22 19:23:18 rillig Exp $	*/
2 # 3 "msg_211.c"
3 
4 // Test for message: function has return type '%s' but returns '%s' [211]
5 
6 struct str {
7 	int member;
8 };
9 
10 int
11 return_int(double dbl, void *ptr, struct str str)
12 {
13 	if (dbl > 0.0)
14 		return dbl;
15 	if (ptr != (void *)0)
16 		/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
17 		return ptr;
18 	if (str.member > 0)
19 		/* expect+1: error: function has return type 'int' but returns 'struct str' [211] */
20 		return str;
21 	return 3;
22 }
23