1 /* $NetBSD: msg_211.c,v 1.7 2024/06/08 09:09:20 rillig Exp $ */
2 # 3 "msg_211.c"
3
4 // Test for message: function has return type '%s' but returns '%s' [211]
5
6 /* lint1-extra-flags: -X 351 */
7
8 struct str {
9 int member;
10 };
11
12 int
return_int(double dbl,void * ptr,struct str str)13 return_int(double dbl, void *ptr, struct str str)
14 {
15 if (dbl > 0.0)
16 return dbl;
17 if (ptr != (void *)0)
18 /* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
19 return ptr;
20 if (str.member > 0)
21 /* expect+1: error: function has return type 'int' but returns 'struct str' [211] */
22 return str;
23 return 3;
24 }
25
26 enum A {
27 A
28 };
29
30 enum B {
31 B
32 };
33
34 enum A
return_enum(enum B arg)35 return_enum(enum B arg)
36 {
37 /* expect+1: warning: function has return type 'enum A' but returns 'enum B' [211] */
38 return arg;
39 }
40