1 /* $NetBSD: msg_163.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ 2 # 3 "msg_163.c" 3 4 // Test for message: a cast does not yield an lvalue [163] 5 6 /* lint1-extra-flags: -X 351 */ 7 8 void example(char * p,int i)9example(char *p, int i) 10 { 11 p++; 12 13 /* 14 * Using a cast as an lvalue had been a GCC extension until 3.4. 15 * It was removed in GCC 4.0. 16 * 17 * https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html#Lvalues 18 * https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/index.html#toc_C-Extensions 19 */ 20 /* expect+2: error: a cast does not yield an lvalue [163] */ 21 /* expect+1: error: operand of 'x++' must be lvalue [114] */ 22 ((char *)p)++; 23 24 i++; 25 26 /* expect+2: error: a cast does not yield an lvalue [163] */ 27 /* expect+1: error: operand of 'x++' must be lvalue [114] */ 28 ((int)i)++; 29 } 30