1 /* $NetBSD: fmt_expr.c,v 1.10 2023/06/16 23:19:01 rillig Exp $ */ 2 3 /* 4 * Tests for all kinds of expressions that are not directly related to unary 5 * or binary operators. 6 * 7 * See also: 8 * lsym_binary_op.c 9 * lsym_unary_op.c 10 */ 11 12 //indent input 13 { 14 // See lsym_offsetof.c. 15 malloc(offsetof(struct s, f) + 1); 16 17 // C99 compound literals use initializer braces. 18 println((const char[3]){'-', c, '\0'}); 19 x = ((struct point){0, 0}).x; 20 21 for (ln = gnodes->first; ln != NULL; ln = ln->next) 22 *(GNode **)Vector_Push(&vec) = ln->datum; 23 } 24 //indent end 25 26 //indent run-equals-input 27 28 29 /* 30 * GCC statement expressions are not supported yet. 31 */ 32 //indent input 33 { 34 int var = ({1}); 35 int var = ({ 36 1 37 }); 38 int var = ({ 39 int decl = 1; 40 stmt; 41 }); 42 } 43 //indent end 44 45 //indent run -di0 46 { 47 int var = ({1}); 48 int var = ({ 49 1 50 }); 51 int var = ({ 52 int decl = 1; 53 stmt; 54 }); 55 } 56 // exit 1 57 // error: Standard Input:7: Unbalanced parentheses 58 // warning: Standard Input:9: Extra ')' 59 //indent end 60