diff --git a/core/encoding/json/types.odin b/core/encoding/json/types.odin index 77cc7db85..6b6d8aae9 100644 --- a/core/encoding/json/types.odin +++ b/core/encoding/json/types.odin @@ -113,6 +113,7 @@ destroy_value :: proc(value: Value, allocator := context.allocator, loc := #call } clone_value :: proc(value: Value, allocator := context.allocator) -> Value { + value := value context.allocator = allocator #partial switch &v in value { diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 53dae5fd5..222222559 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1476,6 +1476,14 @@ gb_internal void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_ return; } + if (switch_kind == TypeSwitch_Union) { + if (is_addressed) { + if (x.mode != Addressing_Variable && !is_type_pointer(x.type)) { + error(lhs->Ident.token, "The element variable '%.*s' cannot be made addressable", LIT(lhs->Ident.token.string)); + } + } + } + Ast *nil_seen = nullptr; TypeSet seen = {};