modernc.org/ccgo/v3@v3.16.14/lib/testdata/bug/init4.c (about)

     1  typedef union {
     2  	struct {
     3  		char type;
     4  		short state;
     5  		char extra;
     6  		char repetition;
     7  	} shift;
     8  	struct {
     9  		char child_count;
    10  		char type;
    11  		short symbol;
    12  		short dynamic_precedence;
    13  		short production_id;
    14  	} reduce;
    15  	char type;
    16  } TSParseAction;
    17  
    18  typedef union {
    19  	TSParseAction action;
    20  	struct {
    21  		char count;
    22  		char reusable;
    23  	} entry;
    24  } TSParseActionEntry;
    25  
    26  static const TSParseActionEntry ts_parse_actions[] = {
    27  	[14] =
    28  		{
    29  			{
    30  				.reduce = {
    31  					.type = 33,
    32  					.dynamic_precedence = 44,
    33  				},
    34  			}
    35  		},
    36  };
    37  
    38  int main() {
    39  	if (sizeof(TSParseAction) != 8) {
    40  		return __LINE__;
    41  	}
    42  
    43  	if (sizeof ts_parse_actions / sizeof(TSParseAction) != 15) {
    44  		return __LINE__;
    45  	}
    46  
    47  	if (ts_parse_actions[14].action.reduce.type != 33) {
    48  		return __LINE__;
    49  	}
    50  
    51  	if (ts_parse_actions[14].action.reduce.dynamic_precedence != 44) {
    52  		return __LINE__;
    53  	}
    54  
    55  	return 0;
    56  }