mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Fix union(T){} constant initialization
This commit is contained in:
@@ -691,8 +691,13 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, lb
|
|||||||
} else if (bt->Union.variants.count == 1) {
|
} else if (bt->Union.variants.count == 1) {
|
||||||
if (value.kind == ExactValue_Compound) {
|
if (value.kind == ExactValue_Compound) {
|
||||||
ast_node(cl, CompoundLit, value.value_compound);
|
ast_node(cl, CompoundLit, value.value_compound);
|
||||||
if (cl->elems.count == 0 && cl->type == nullptr) {
|
if (cl->elems.count == 0) {
|
||||||
return lb_const_nil(m, original_type);
|
if (cl->type == nullptr) {
|
||||||
|
return lb_const_nil(m, original_type);
|
||||||
|
}
|
||||||
|
if (are_types_identical(type_of_expr(cl->type), original_type)) {
|
||||||
|
return lb_const_nil(m, original_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user