1 /*        $NetBSD: gcc_statement_expression.c,v 1.3 2023/07/15 14:54:31 rillig Exp $      */
2 # 3 "gcc_statement_expression.c"
3 
4 /*
5  * Tests for the GCC extension 'statement expressions', which allows a block of
6  * statements to occur as part of an expression.
7  */
8 
9 
10 // Ensure that the inner types are accessible from outside the block.
11 // Depending on the memory management strategy, the inner types might be freed
12 // too early.
13 static inline int
use_inner_type_from_outside(void)14 use_inner_type_from_outside(void)
15 {
16           int x = ({
17                     struct outer {
18                               struct inner {
19                                         int member;
20                               } inner;
21                     } outer = { { 3 } };
22                     outer;
23           }).inner.member;
24 
25           return x;
26 }
27