modernc.org/ccgo/v3@v3.16.14/lib/testdata/bug/struct2.c (about) 1 // https://gitlab.com/cznic/ccgo/-/issues/21#note_704291242 2 3 #include <stdbool.h> 4 #include <stdint.h> 5 #include <stdio.h> 6 7 typedef struct { 8 bool is_inline : 1; 9 bool visible : 1; 10 bool named : 1; 11 bool extra : 1; 12 bool has_changes : 1; 13 bool is_missing : 1; 14 bool is_keyword : 1; 15 uint8_t symbol; 16 uint8_t padding_bytes; 17 uint8_t size_bytes; 18 uint8_t padding_columns; 19 uint8_t padding_rows : 4; 20 uint8_t lookahead_bytes : 4; 21 uint16_t parse_state; 22 } SubtreeInlineData; 23 24 typedef struct { 25 uint32_t child_count; 26 } SubtreeHeapData; 27 28 typedef union { 29 SubtreeInlineData data; 30 const SubtreeHeapData *ptr; 31 } Subtree; 32 33 typedef struct { 34 Subtree tree; 35 uint32_t child_index; 36 uint32_t byte_offset; 37 } StackEntry; 38 39 int main() { 40 Subtree tree; 41 uint32_t next_index; 42 uint32_t byte_offset; 43 ((StackEntry) { 44 .tree = (Subtree){.data.visible = 1}, 45 .child_index = next_index, 46 .byte_offset = byte_offset, 47 }); 48 }