| ... | ... | @@ -2325,8 +2325,14 @@ static void resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) { |
| 2325 | 2325 | HashMap<BigInt, AstNode *, bigint_hash, bigint_eql> occupied_tag_values = {}; |
| 2326 | 2326 | occupied_tag_values.init(field_count); |
| 2327 | 2327 | |
| 2328 | | TypeTableEntry *tag_int_type = get_smallest_unsigned_int_type(g, field_count - 1); |
| 2328 | TypeTableEntry *tag_int_type; |
| 2329 | if (enum_type->data.enumeration.layout == ContainerLayoutExtern) { |
| 2330 | tag_int_type = get_c_int_type(g, CIntTypeInt); |
| 2331 | } else { |
| 2332 | tag_int_type = get_smallest_unsigned_int_type(g, field_count - 1); |
| 2333 | } |
| 2329 | 2334 | |
| 2335 | // TODO: Are extern enums allowed to have an init_arg_expr? |
| 2330 | 2336 | if (decl_node->data.container_decl.init_arg_expr != nullptr) { |
| 2331 | 2337 | TypeTableEntry *wanted_tag_int_type = analyze_type_expr(g, scope, decl_node->data.container_decl.init_arg_expr); |
| 2332 | 2338 | if (type_is_invalid(wanted_tag_int_type)) { |