msg_331.c revision 1.7
1/* $NetBSD: msg_331.c,v 1.7 2023/08/02 18:51:25 rillig Exp $ */ 2# 3 "msg_331.c" 3 4// Test for message: left operand of '%s' must be bool, not '%s' [331] 5// 6// See d_c99_bool_strict.c for many more examples. 7 8/* lint1-extra-flags: -T -X 351 */ 9 10typedef _Bool bool; 11 12void 13test(bool); 14 15void 16example(bool b, char c, int i) 17{ 18 test(b && b); 19 20 /* expect+2: error: left operand of '&&' must be bool, not 'char' [331] */ 21 /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ 22 test(c && b); 23 24 /* expect+2: error: left operand of '&&' must be bool, not 'int' [331] */ 25 /* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */ 26 test(i && b); 27 28 test(c != '\0'); 29 test(i != 0); 30} 31