| ... | ... | @@ -2560,8 +2560,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) { |
| 2560 | 2560 | |
| 2561 | 2561 | assert(!enum_type->data.enumeration.fields); |
| 2562 | 2562 | uint32_t field_count = (uint32_t)decl_node->data.container_decl.fields.length; |
| 2563 | | if (field_count == 0 || (field_count == 1 && |
| 2564 | | buf_eql_str(decl_node->data.container_decl.fields.at(0)->data.struct_field.name, "_"))) { |
| 2563 | if (field_count == 0) { |
| 2565 | 2564 | add_node_error(g, decl_node, buf_sprintf("enums must have 1 or more fields")); |
| 2566 | 2565 | |
| 2567 | 2566 | enum_type->data.enumeration.src_field_count = field_count; |
| ... | ... | @@ -2657,7 +2656,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) { |
| 2657 | 2656 | add_node_error(g, field_node, buf_sprintf("non-exhaustive enum must specify size")); |
| 2658 | 2657 | enum_type->data.enumeration.resolve_status = ResolveStatusInvalid; |
| 2659 | 2658 | } |
| 2660 | | if (log2_u64(field_count - 1) == enum_type->size_in_bits) { |
| 2659 | if (field_count > 1 && log2_u64(field_count - 1) == enum_type->size_in_bits) { |
| 2661 | 2660 | add_node_error(g, field_node, buf_sprintf("non-exhaustive enum specifies every value")); |
| 2662 | 2661 | enum_type->data.enumeration.resolve_status = ResolveStatusInvalid; |
| 2663 | 2662 | } |