1 1.7 rillig /* $NetBSD: d_gcc_compound_statements1.c,v 1.7 2022/01/15 14:22:03 rillig Exp $ */ 2 1.2 rillig # 3 "d_gcc_compound_statements1.c" 3 1.2 rillig 4 1.4 rillig /* GCC compound statement with expression */ 5 1.1 jruoho 6 1.1 jruoho foo(unsigned long z) 7 1.1 jruoho { 8 1.3 rillig z = ({ 9 1.3 rillig unsigned long tmp; 10 1.3 rillig tmp = 1; 11 1.3 rillig tmp; 12 1.3 rillig }); 13 1.1 jruoho foo(z); 14 1.1 jruoho } 15 1.5 rillig 16 1.5 rillig /* 17 1.5 rillig * Compound statements are only allowed in functions, not at file scope. 18 1.5 rillig * 19 1.5 rillig * Before decl.c 1.186 from 2021-06-19, lint crashed with a segmentation 20 1.5 rillig * fault. 21 1.5 rillig */ 22 1.5 rillig int c = ({ 23 1.7 rillig /* expect+1: error: syntax error 'return outside function' [249] */ 24 1.7 rillig return 3; 25 1.7 rillig }); 26 1.7 rillig /* expect-1: error: cannot initialize 'int' from 'void' [185] */ 27 1.6 rillig 28 1.6 rillig void 29 1.6 rillig function(void) 30 1.6 rillig { 31 1.6 rillig /* 32 1.6 rillig * Before cgram.y 1.229 from 2021-06-20, lint crashed due to the 33 1.6 rillig * syntax error, which made an expression NULL. 34 1.6 rillig */ 35 1.6 rillig ({ 36 1.7 rillig /* expect+1: error: type 'int' does not have member 'e' [101] */ 37 1.7 rillig 0->e; 38 1.6 rillig }); 39 1.6 rillig } 40