| ... | ... | @@ -1802,10 +1802,18 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { |
| 1802 | 1802 | } |
| 1803 | 1803 | return type_allowed_in_extern(g, child_type, result); |
| 1804 | 1804 | } |
| 1805 | | case ZigTypeIdEnum: |
| 1806 | | *result = type_entry->data.enumeration.layout == ContainerLayoutExtern || |
| 1807 | | type_entry->data.enumeration.layout == ContainerLayoutPacked; |
| 1808 | | return ErrorNone; |
| 1805 | case ZigTypeIdEnum: { |
| 1806 | if ((err = type_resolve(g, type_entry, ResolveStatusZeroBitsKnown))) |
| 1807 | return err; |
| 1808 | ZigType *tag_int_type = type_entry->data.enumeration.tag_int_type; |
| 1809 | if (type_entry->data.enumeration.has_explicit_tag_type) { |
| 1810 | return type_allowed_in_extern(g, tag_int_type, result); |
| 1811 | } else { |
| 1812 | *result = type_entry->data.enumeration.layout == ContainerLayoutExtern || |
| 1813 | type_entry->data.enumeration.layout == ContainerLayoutPacked; |
| 1814 | return ErrorNone; |
| 1815 | } |
| 1816 | } |
| 1809 | 1817 | case ZigTypeIdUnion: |
| 1810 | 1818 | *result = type_entry->data.unionation.layout == ContainerLayoutExtern || |
| 1811 | 1819 | type_entry->data.unionation.layout == ContainerLayoutPacked; |
| ... | ... | @@ -2639,9 +2647,11 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) { |
| 2639 | 2647 | if (decl_node->type == NodeTypeContainerDecl) { |
| 2640 | 2648 | if (decl_node->data.container_decl.init_arg_expr != nullptr) { |
| 2641 | 2649 | wanted_tag_int_type = analyze_type_expr(g, scope, decl_node->data.container_decl.init_arg_expr); |
| 2650 | enum_type->data.enumeration.has_explicit_tag_type = true; |
| 2642 | 2651 | } |
| 2643 | 2652 | } else { |
| 2644 | 2653 | wanted_tag_int_type = enum_type->data.enumeration.tag_int_type; |
| 2654 | enum_type->data.enumeration.has_explicit_tag_type = true; |
| 2645 | 2655 | } |
| 2646 | 2656 | |
| 2647 | 2657 | if (wanted_tag_int_type != nullptr) { |