mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix #5831
This commit is contained in:
@@ -689,6 +689,13 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb
|
|||||||
if (bt->Union.variants.count == 0) {
|
if (bt->Union.variants.count == 0) {
|
||||||
return lb_const_nil(m, original_type);
|
return lb_const_nil(m, original_type);
|
||||||
} else if (bt->Union.variants.count == 1) {
|
} 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];
|
Type *t = bt->Union.variants[0];
|
||||||
lbValue cv = lb_const_value(m, t, value, cc);
|
lbValue cv = lb_const_value(m, t, value, cc);
|
||||||
GB_ASSERT(LLVMIsConstant(cv.value));
|
GB_ASSERT(LLVMIsConstant(cv.value));
|
||||||
|
|||||||
Reference in New Issue
Block a user