diff options
| author | gingerBill <bill@gingerbill.org> | 2019-12-15 09:48:05 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-12-15 09:48:05 +0000 |
| commit | e6f26b9931af0b05b93447639fba7569691ac0d0 (patch) | |
| tree | a79ea09d102c9c79863b983b6c835726abeeb2f7 /src/ir.cpp | |
| parent | b8c534eba9b1b27d7c0d1db6eeda939ba56e8313 (diff) | |
Fix Unable to initialize a typeid field in a struct literal #501
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 9639760f0..6a9835636 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8184,6 +8184,7 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) { Selection sel = lookup_field(bt, name, false); index = sel.index[0]; elem = fv->value; + TypeAndValue tav = type_and_value_of_expr(elem); } else { TypeAndValue tav = type_and_value_of_expr(elem); Selection sel = lookup_field_from_index(bt, st->fields[field_index]->Variable.field_src_index); @@ -8192,12 +8193,13 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) { field = st->fields[index]; Type *ft = field->type; - if (!is_raw_union && ir_is_elem_const(proc->module, elem, ft)) { + if (!is_raw_union && !is_type_typeid(ft) && ir_is_elem_const(proc->module, elem, ft)) { continue; } field_expr = ir_build_expr(proc, elem); + GB_ASSERT(ir_type(field_expr)->kind != Type_Tuple); Type *fet = ir_type(field_expr); |