authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-25 02:50:18+03:00
committergravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-25 02:50:18+03:00
log778b931bf33c9b19502857af918fc159c0cd8e83
treee4a453877bb2d876204bd30f69bbee94f5ba716a
parent182a9fad2d55973ab50f4a2170edb88d6708681d

Fixed comptime union void field access


1 files changed, 12 insertions(+), 3 deletions(-)

src/ir.cpp+12-3
...@@ -13495,8 +13495,18 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_...@@ -13495,8 +13495,18 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
13495 }13495 }
1349613496
13497 ConstExprValue *payload_val = union_val->data.x_union.payload;13497 ConstExprValue *payload_val = union_val->data.x_union.payload;
13498 TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, payload_val->type, is_const, is_volatile,13498
13499 get_abi_alignment(ira->codegen, payload_val->type), 0, 0);13499 TypeTableEntry *field_type = field->type_entry;
13500 if (field_type->id == TypeTableEntryIdVoid)
13501 {
13502 assert(payload_val == nullptr);
13503 payload_val = create_const_vals(1);
13504 payload_val->special = ConstValSpecialStatic;
13505 payload_val->type = field_type;
13506 }
13507
13508 TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, field_type, is_const, is_volatile,
13509 get_abi_alignment(ira->codegen, field_type), 0, 0);
1350013510
13501 IrInstruction *result = ir_get_const(ira, source_instr);13511 IrInstruction *result = ir_get_const(ira, source_instr);
13502 ConstExprValue *const_val = &result->value;13512 ConstExprValue *const_val = &result->value;
...@@ -15749,7 +15759,6 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, ConstExprValue *p...@@ -15749,7 +15759,6 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, ConstExprValue *p
15749 case TypeTableEntryIdBlock:15759 case TypeTableEntryIdBlock:
15750 case TypeTableEntryIdArgTuple:15760 case TypeTableEntryIdArgTuple:
15751 case TypeTableEntryIdOpaque:15761 case TypeTableEntryIdOpaque:
15752 // TODO: Construct a valid void payload.
15753 return nullptr;15762 return nullptr;
15754 case TypeTableEntryIdInt:15763 case TypeTableEntryIdInt:
15755 {15764 {