diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-03-07 14:35:48 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-03-07 14:35:48 -0500 |
| commit | 790aaeacaea88782987c4145bc7ae47a401563f1 (patch) | |
| tree | 0aad6bf2e1c29b0dab883a2633b4d380f68dfc51 /src/analyze.cpp | |
| parent | bb80daf509b7afd84fe3076347e69e8f39f586d6 (diff) | |
| download | zig-790aaeacaea88782987c4145bc7ae47a401563f1.tar.gz zig-790aaeacaea88782987c4145bc7ae47a401563f1.zip | |
add compile error for using @tagName on extern union
closes #742
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 66d2963425..74dfd003d9 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -2558,6 +2558,8 @@ static void resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) { HashMap<BigInt, AstNode *, bigint_hash, bigint_eql> occupied_tag_values = {}; AstNode *enum_type_node = decl_node->data.container_decl.init_arg_expr; + union_type->data.unionation.have_explicit_tag_type = decl_node->data.container_decl.auto_enum || + enum_type_node != nullptr; bool auto_layout = (union_type->data.unionation.layout == ContainerLayoutAuto); bool want_safety = (field_count >= 2) && (auto_layout || enum_type_node != nullptr); TypeTableEntry *tag_type; |
