| ... | ... | @@ -16966,8 +16966,6 @@ static IrInstGen *ir_analyze_tuple_cat(IrAnalyze *ira, IrInst* source_instr, |
| 16966 | 16966 | new_type->data.structure.special = StructSpecialInferredTuple; |
| 16967 | 16967 | new_type->data.structure.resolve_status = ResolveStatusBeingInferred; |
| 16968 | 16968 | |
| 16969 | | bool is_comptime = ir_should_inline(ira->old_irb.exec, source_instr->scope); |
| 16970 | | |
| 16971 | 16969 | IrInstGen *new_struct_ptr = ir_resolve_result(ira, source_instr, no_result_loc(), |
| 16972 | 16970 | new_type, nullptr, false, true); |
| 16973 | 16971 | uint32_t new_field_count = op1_field_count + op2_field_count; |
| ... | ... | @@ -16995,7 +16993,6 @@ static IrInstGen *ir_analyze_tuple_cat(IrAnalyze *ira, IrInst* source_instr, |
| 16995 | 16993 | return ira->codegen->invalid_inst_gen; |
| 16996 | 16994 | |
| 16997 | 16995 | ZigList<IrInstGen *> const_ptrs = {}; |
| 16998 | | IrInstGen *first_non_const_instruction = nullptr; |
| 16999 | 16996 | for (uint32_t i = 0; i < new_field_count; i += 1) { |
| 17000 | 16997 | TypeStructField *dst_field = new_type->data.structure.fields[i]; |
| 17001 | 16998 | IrInstGen *src_struct_op; |
| ... | ... | @@ -17017,8 +17014,6 @@ static IrInstGen *ir_analyze_tuple_cat(IrAnalyze *ira, IrInst* source_instr, |
| 17017 | 17014 | return ira->codegen->invalid_inst_gen; |
| 17018 | 17015 | if (instr_is_comptime(field_value)) { |
| 17019 | 17016 | const_ptrs.append(dest_ptr); |
| 17020 | | } else { |
| 17021 | | first_non_const_instruction = field_value; |
| 17022 | 17017 | } |
| 17023 | 17018 | IrInstGen *store_ptr_inst = ir_analyze_store_ptr(ira, source_instr, dest_ptr, field_value, |
| 17024 | 17019 | true); |
| ... | ... | @@ -17035,20 +17030,13 @@ static IrInstGen *ir_analyze_tuple_cat(IrAnalyze *ira, IrInst* source_instr, |
| 17035 | 17030 | continue; |
| 17036 | 17031 | } |
| 17037 | 17032 | IrInstGen *deref = ir_get_deref(ira, &elem_result_loc->base, elem_result_loc, nullptr); |
| 17038 | | elem_result_loc->value->special = ConstValSpecialRuntime; |
| 17039 | | ir_analyze_store_ptr(ira, &elem_result_loc->base, elem_result_loc, deref, false); |
| 17033 | if (!type_requires_comptime(ira->codegen, elem_result_loc->value->type->data.pointer.child_type)) { |
| 17034 | elem_result_loc->value->special = ConstValSpecialRuntime; |
| 17035 | } |
| 17036 | ir_analyze_store_ptr(ira, &elem_result_loc->base, elem_result_loc, deref, true); |
| 17040 | 17037 | } |
| 17041 | 17038 | } |
| 17042 | 17039 | IrInstGen *result = ir_get_deref(ira, source_instr, new_struct_ptr, nullptr); |
| 17043 | | if (instr_is_comptime(result)) |
| 17044 | | return result; |
| 17045 | | |
| 17046 | | if (is_comptime) { |
| 17047 | | ir_add_error(ira, &first_non_const_instruction->base, |
| 17048 | | buf_sprintf("unable to evaluate constant expression")); |
| 17049 | | return ira->codegen->invalid_inst_gen; |
| 17050 | | } |
| 17051 | | |
| 17052 | 17040 | return result; |
| 17053 | 17041 | } |
| 17054 | 17042 | |
| ... | ... | @@ -23065,8 +23053,11 @@ static IrInstGen *ir_analyze_instruction_container_init_list(IrAnalyze *ira, |
| 23065 | 23053 | } |
| 23066 | 23054 | } |
| 23067 | 23055 | |
| 23056 | const_ptrs.deinit(); |
| 23057 | |
| 23068 | 23058 | IrInstGen *result = ir_get_deref(ira, &instruction->base.base, result_loc, nullptr); |
| 23069 | | if (instr_is_comptime(result)) |
| 23059 | // If the result is a tuple, we are allowed to return a struct that uses ConstValSpecialRuntime fields at comptime. |
| 23060 | if (instr_is_comptime(result) || is_tuple(container_type)) |
| 23070 | 23061 | return result; |
| 23071 | 23062 | |
| 23072 | 23063 | if (is_comptime) { |