diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-01 00:34:29 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-01 00:34:29 -0500 |
| commit | 264c86853b714482d006baa38482a6f7d55e8d94 (patch) | |
| tree | 2e402053b226aeae2dbbf732edaa761cdeb8828b /src/analyze.cpp | |
| parent | b62e2fd8703129fcf0dc80675800f005e84ee724 (diff) | |
| download | zig-264c86853b714482d006baa38482a6f7d55e8d94.tar.gz zig-264c86853b714482d006baa38482a6f7d55e8d94.zip | |
packed structs can have enums with explicit tag types
See #305
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 33d6ccdc39..235aeea682 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1536,7 +1536,6 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) { case TypeTableEntryIdNullLit: case TypeTableEntryIdErrorUnion: case TypeTableEntryIdPureError: - case TypeTableEntryIdEnum: case TypeTableEntryIdEnumTag: case TypeTableEntryIdNamespace: case TypeTableEntryIdBlock: @@ -1560,6 +1559,9 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) { TypeTableEntry *child_type = type_entry->data.maybe.child_type; return child_type->id == TypeTableEntryIdPointer || child_type->id == TypeTableEntryIdFn; } + case TypeTableEntryIdEnum: + return type_entry->data.enumeration.gen_field_count == 0 && + type_entry->data.enumeration.decl_node->data.container_decl.init_arg_expr != nullptr; } zig_unreachable(); } |
