diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-09-28 21:08:47 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-09-28 21:08:47 +0100 |
| commit | 35a32d41e03ad10134d7705e4e502c1a23f39d47 (patch) | |
| tree | 411c92c112c448de90f3080dbd49692c7bc7dda2 /src | |
| parent | f743110f63d7659d0990715311ea64fea056e249 (diff) | |
Fix `Union{}`
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend_const.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index d3e2826ed..9563e4800 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -885,6 +885,16 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb i64 block_size = bt->Union.variant_block_size; + if (are_types_identical(value_type, original_type)) { + if (value.kind == ExactValue_Compound) { + ast_node(cl, CompoundLit, value.value_compound); + GB_ASSERT(cl->elems.count == 0); + return lb_const_nil(m, original_type); + } + + GB_PANIC("%s vs %s", type_to_string(value_type), type_to_string(original_type)); + } + lbValue cv = lb_const_value(m, value_type, value, cc, value_type); Type *variant_type = cv.type; |