diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-22 09:07:46 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-22 09:07:46 +0100 |
| commit | 55ab18f911aec918587e27d2e2b5d907cf6d0743 (patch) | |
| tree | a83a134b929c9baa878aabe7aacf74af5b590304 /src/llvm_backend_const.cpp | |
| parent | 35df604d87c2744eab76c547607ab91fac5cb59b (diff) | |
Fix #5831
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 4c154c85a..a7117fe0b 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -689,6 +689,13 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb if (bt->Union.variants.count == 0) { return lb_const_nil(m, original_type); } else if (bt->Union.variants.count == 1) { + if (value.kind == ExactValue_Compound) { + ast_node(cl, CompoundLit, value.value_compound); + if (cl->elems.count == 0 && cl->type == nullptr) { + return lb_const_nil(m, original_type); + } + } + Type *t = bt->Union.variants[0]; lbValue cv = lb_const_value(m, t, value, cc); GB_ASSERT(LLVMIsConstant(cv.value)); |