| author | |
| committer | |
| log | 2e6aa6d813cf3fd4180b8c9ffc671b4bcee54586 |
| tree | a9ada6a05284c7692ac608c78f0fcc20f54588e1 |
| parent | a76b048354e5754b18ecd83ad21cf45c5a34e276 |
2 files changed, 11 insertions(+), 1 deletions(-)
src/codegen.cpp+2| ... | ... | @@ -2854,6 +2854,8 @@ static void do_code_gen(CodeGen *g) { |
| 2854 | 2854 | } else if (instruction->id == IrInstructionIdRef) { |
| 2855 | 2855 | IrInstructionRef *ref_instruction = (IrInstructionRef *)instruction; |
| 2856 | 2856 | slot = &ref_instruction->tmp_ptr; |
| 2857 | assert(instruction->type_entry->id == TypeTableEntryIdPointer); | |
| 2858 | slot_type = instruction->type_entry->data.pointer.child_type; | |
| 2857 | 2859 | } else if (instruction->id == IrInstructionIdContainerInitList) { |
| 2858 | 2860 | IrInstructionContainerInitList *container_init_list_instruction = (IrInstructionContainerInitList *)instruction; |
| 2859 | 2861 | slot = &container_init_list_instruction->tmp_ptr; |
src/ir.cpp+9-1| ... | ... | @@ -4732,7 +4732,15 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_ |
| 4732 | 4732 | IrInstructionLoadPtr *load_ptr_inst = (IrInstructionLoadPtr *)value; |
| 4733 | 4733 | return load_ptr_inst->ptr; |
| 4734 | 4734 | } else { |
| 4735 | zig_panic("TODO more ways to cast to const pointer"); | |
| 4735 | IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instr->scope, source_instr->source_node, value); | |
| 4736 | ||
| 4737 | TypeTableEntry *child_type = wanted_type->data.pointer.child_type; | |
| 4738 | if (type_has_bits(child_type)) { | |
| 4739 | FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec); | |
| 4740 | assert(fn_entry); | |
| 4741 | fn_entry->alloca_list.append(new_instruction); | |
| 4742 | } | |
| 4743 | return new_instruction; | |
| 4736 | 4744 | } |
| 4737 | 4745 | } |
| 4738 | 4746 |