| ... | ... | @@ -4533,7 +4533,12 @@ static TypeTableEntry *ir_analyze_const_usize(IrAnalyze *ira, IrInstruction *ins |
| 4533 | 4533 | return ira->codegen->builtin_types.entry_usize; |
| 4534 | 4534 | } |
| 4535 | 4535 | |
| 4536 | | static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value) { |
| 4536 | enum UndefAllowed { |
| 4537 | UndefOk, |
| 4538 | UndefBad, |
| 4539 | }; |
| 4540 | |
| 4541 | static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, UndefAllowed undef_allowed) { |
| 4537 | 4542 | switch (value->static_value.special) { |
| 4538 | 4543 | case ConstValSpecialStatic: |
| 4539 | 4544 | return &value->static_value; |
| ... | ... | @@ -4541,8 +4546,12 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value) { |
| 4541 | 4546 | ir_add_error(ira, value, buf_sprintf("unable to evaluate constant expression")); |
| 4542 | 4547 | return nullptr; |
| 4543 | 4548 | case ConstValSpecialUndef: |
| 4544 | | ir_add_error(ira, value, buf_sprintf("use of undefined value")); |
| 4545 | | return nullptr; |
| 4549 | if (undef_allowed == UndefOk) { |
| 4550 | return &value->static_value; |
| 4551 | } else { |
| 4552 | ir_add_error(ira, value, buf_sprintf("use of undefined value")); |
| 4553 | return nullptr; |
| 4554 | } |
| 4546 | 4555 | case ConstValSpecialZeroes: |
| 4547 | 4556 | ir_add_error(ira, value, buf_sprintf("zeroes is deprecated")); |
| 4548 | 4557 | return nullptr; |
| ... | ... | @@ -4595,10 +4604,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 4595 | 4604 | return result; |
| 4596 | 4605 | } |
| 4597 | 4606 | |
| 4598 | | static TypeTableEntry *ir_resolve_type_lval(IrAnalyze *ira, IrInstruction *type_value, LValPurpose lval) { |
| 4599 | | if (lval != LValPurposeNone) |
| 4600 | | zig_panic("TODO"); |
| 4601 | | |
| 4607 | static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { |
| 4602 | 4608 | if (type_value->type_entry->id == TypeTableEntryIdInvalid) |
| 4603 | 4609 | return ira->codegen->builtin_types.entry_invalid; |
| 4604 | 4610 | |
| ... | ... | @@ -4608,17 +4614,13 @@ static TypeTableEntry *ir_resolve_type_lval(IrAnalyze *ira, IrInstruction *type_ |
| 4608 | 4614 | return ira->codegen->builtin_types.entry_invalid; |
| 4609 | 4615 | } |
| 4610 | 4616 | |
| 4611 | | ConstExprValue *const_val = ir_resolve_const(ira, type_value); |
| 4617 | ConstExprValue *const_val = ir_resolve_const(ira, type_value, UndefBad); |
| 4612 | 4618 | if (!const_val) |
| 4613 | 4619 | return ira->codegen->builtin_types.entry_invalid; |
| 4614 | 4620 | |
| 4615 | 4621 | return const_val->data.x_type; |
| 4616 | 4622 | } |
| 4617 | 4623 | |
| 4618 | | static TypeTableEntry *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) { |
| 4619 | | return ir_resolve_type_lval(ira, type_value, LValPurposeNone); |
| 4620 | | } |
| 4621 | | |
| 4622 | 4624 | static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { |
| 4623 | 4625 | if (fn_value == ira->codegen->invalid_instruction) |
| 4624 | 4626 | return nullptr; |
| ... | ... | @@ -4632,7 +4634,7 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { |
| 4632 | 4634 | return nullptr; |
| 4633 | 4635 | } |
| 4634 | 4636 | |
| 4635 | | ConstExprValue *const_val = ir_resolve_const(ira, fn_value); |
| 4637 | ConstExprValue *const_val = ir_resolve_const(ira, fn_value, UndefBad); |
| 4636 | 4638 | if (!const_val) |
| 4637 | 4639 | return nullptr; |
| 4638 | 4640 | |
| ... | ... | @@ -4643,7 +4645,7 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc |
| 4643 | 4645 | assert(wanted_type->id == TypeTableEntryIdMaybe); |
| 4644 | 4646 | |
| 4645 | 4647 | if (instr_is_comptime(value)) { |
| 4646 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 4648 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 4647 | 4649 | if (!val) |
| 4648 | 4650 | return ira->codegen->invalid_instruction; |
| 4649 | 4651 | |
| ... | ... | @@ -4667,7 +4669,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction |
| 4667 | 4669 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); |
| 4668 | 4670 | |
| 4669 | 4671 | if (instr_is_comptime(value)) { |
| 4670 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 4672 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 4671 | 4673 | if (!val) |
| 4672 | 4674 | return ira->codegen->invalid_instruction; |
| 4673 | 4675 | |
| ... | ... | @@ -4692,7 +4694,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so |
| 4692 | 4694 | assert(wanted_type->id == TypeTableEntryIdErrorUnion); |
| 4693 | 4695 | |
| 4694 | 4696 | if (instr_is_comptime(value)) { |
| 4695 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 4697 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 4696 | 4698 | if (!val) |
| 4697 | 4699 | return ira->codegen->invalid_instruction; |
| 4698 | 4700 | |
| ... | ... | @@ -4717,7 +4719,7 @@ static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *so |
| 4717 | 4719 | assert(wanted_type->id == TypeTableEntryIdMaybe); |
| 4718 | 4720 | assert(instr_is_comptime(value)); |
| 4719 | 4721 | |
| 4720 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 4722 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 4721 | 4723 | assert(val); |
| 4722 | 4724 | |
| 4723 | 4725 | IrInstructionConst *const_instruction = ir_create_instruction<IrInstructionConst>(ira->new_irb.exec, source_instr->scope, source_instr->source_node); |
| ... | ... | @@ -5020,7 +5022,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc |
| 5020 | 5022 | load_ptr_instruction->type_entry = child_type; |
| 5021 | 5023 | return load_ptr_instruction; |
| 5022 | 5024 | } else if (type_entry->id == TypeTableEntryIdMetaType) { |
| 5023 | | ConstExprValue *ptr_val = ir_resolve_const(ira, ptr); |
| 5025 | ConstExprValue *ptr_val = ir_resolve_const(ira, ptr, UndefBad); |
| 5024 | 5026 | if (!ptr_val) |
| 5025 | 5027 | return ira->codegen->invalid_instruction; |
| 5026 | 5028 | |
| ... | ... | @@ -5047,7 +5049,7 @@ static TypeTableEntry *ir_analyze_ref(IrAnalyze *ira, IrInstruction *source_inst |
| 5047 | 5049 | |
| 5048 | 5050 | bool is_inline = ir_should_inline(&ira->new_irb); |
| 5049 | 5051 | if (is_inline || value->static_value.special != ConstValSpecialRuntime) { |
| 5050 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 5052 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 5051 | 5053 | if (!val) |
| 5052 | 5054 | return ira->codegen->builtin_types.entry_invalid; |
| 5053 | 5055 | bool ptr_is_const = true; |
| ... | ... | @@ -5071,7 +5073,7 @@ static bool ir_resolve_usize(IrAnalyze *ira, IrInstruction *value, uint64_t *out |
| 5071 | 5073 | if (casted_value->type_entry->id == TypeTableEntryIdInvalid) |
| 5072 | 5074 | return false; |
| 5073 | 5075 | |
| 5074 | | ConstExprValue *const_val = ir_resolve_const(ira, casted_value); |
| 5076 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| 5075 | 5077 | if (!const_val) |
| 5076 | 5078 | return false; |
| 5077 | 5079 | |
| ... | ... | @@ -5087,7 +5089,7 @@ static bool ir_resolve_bool(IrAnalyze *ira, IrInstruction *value, bool *out) { |
| 5087 | 5089 | if (casted_value->type_entry->id == TypeTableEntryIdInvalid) |
| 5088 | 5090 | return false; |
| 5089 | 5091 | |
| 5090 | | ConstExprValue *const_val = ir_resolve_const(ira, casted_value); |
| 5092 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| 5091 | 5093 | if (!const_val) |
| 5092 | 5094 | return false; |
| 5093 | 5095 | |
| ... | ... | @@ -5103,7 +5105,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic |
| 5103 | 5105 | if (casted_value->type_entry->id == TypeTableEntryIdInvalid) |
| 5104 | 5106 | return false; |
| 5105 | 5107 | |
| 5106 | | ConstExprValue *const_val = ir_resolve_const(ira, casted_value); |
| 5108 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| 5107 | 5109 | if (!const_val) |
| 5108 | 5110 | return false; |
| 5109 | 5111 | |
| ... | ... | @@ -5120,7 +5122,7 @@ static Buf *ir_resolve_str(IrAnalyze *ira, IrInstruction *value) { |
| 5120 | 5122 | if (casted_value->type_entry->id == TypeTableEntryIdInvalid) |
| 5121 | 5123 | return nullptr; |
| 5122 | 5124 | |
| 5123 | | ConstExprValue *const_val = ir_resolve_const(ira, casted_value); |
| 5125 | ConstExprValue *const_val = ir_resolve_const(ira, casted_value, UndefBad); |
| 5124 | 5126 | if (!const_val) |
| 5125 | 5127 | return nullptr; |
| 5126 | 5128 | |
| ... | ... | @@ -5504,11 +5506,11 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 5504 | 5506 | if (op2_canon_type->id == TypeTableEntryIdInvalid) |
| 5505 | 5507 | return ira->codegen->builtin_types.entry_invalid; |
| 5506 | 5508 | |
| 5507 | | ConstExprValue *op1_val = ir_resolve_const(ira, op1); |
| 5509 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| 5508 | 5510 | if (!op1_val) |
| 5509 | 5511 | return ira->codegen->builtin_types.entry_invalid; |
| 5510 | 5512 | |
| 5511 | | ConstExprValue *op2_val = ir_resolve_const(ira, op2); |
| 5513 | ConstExprValue *op2_val = ir_resolve_const(ira, op2, UndefBad); |
| 5512 | 5514 | if (!op2_val) |
| 5513 | 5515 | return ira->codegen->builtin_types.entry_invalid; |
| 5514 | 5516 | |
| ... | ... | @@ -5620,7 +5622,7 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp |
| 5620 | 5622 | if (op2->type_entry->id == TypeTableEntryIdInvalid) |
| 5621 | 5623 | return ira->codegen->builtin_types.entry_invalid; |
| 5622 | 5624 | |
| 5623 | | ConstExprValue *array_val = ir_resolve_const(ira, op1); |
| 5625 | ConstExprValue *array_val = ir_resolve_const(ira, op1, UndefBad); |
| 5624 | 5626 | if (!array_val) |
| 5625 | 5627 | return ira->codegen->builtin_types.entry_invalid; |
| 5626 | 5628 | |
| ... | ... | @@ -5825,7 +5827,7 @@ static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node |
| 5825 | 5827 | if (casted_arg->type_entry->id == TypeTableEntryIdInvalid) |
| 5826 | 5828 | return false; |
| 5827 | 5829 | |
| 5828 | | ConstExprValue *first_arg_val = ir_resolve_const(ira, casted_arg); |
| 5830 | ConstExprValue *first_arg_val = ir_resolve_const(ira, casted_arg, UndefBad); |
| 5829 | 5831 | if (!first_arg_val) |
| 5830 | 5832 | return false; |
| 5831 | 5833 | |
| ... | ... | @@ -5862,7 +5864,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 5862 | 5864 | |
| 5863 | 5865 | bool inline_arg = param_decl_node->data.param_decl.is_inline; |
| 5864 | 5866 | if (inline_arg || is_var_type) { |
| 5865 | | ConstExprValue *arg_val = ir_resolve_const(ira, casted_arg); |
| 5867 | ConstExprValue *arg_val = ir_resolve_const(ira, casted_arg, UndefBad); |
| 5866 | 5868 | if (!arg_val) |
| 5867 | 5869 | return false; |
| 5868 | 5870 | |
| ... | ... | @@ -6797,7 +6799,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 6797 | 6799 | return ira->codegen->builtin_types.entry_invalid; |
| 6798 | 6800 | } |
| 6799 | 6801 | } else if (container_type->id == TypeTableEntryIdMetaType) { |
| 6800 | | ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr); |
| 6802 | ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr, UndefBad); |
| 6801 | 6803 | if (!container_ptr_val) |
| 6802 | 6804 | return ira->codegen->builtin_types.entry_invalid; |
| 6803 | 6805 | |
| ... | ... | @@ -6880,7 +6882,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 6880 | 6882 | } |
| 6881 | 6883 | } else if (container_type->id == TypeTableEntryIdNamespace) { |
| 6882 | 6884 | assert(container_ptr->type_entry->id == TypeTableEntryIdPointer); |
| 6883 | | ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr); |
| 6885 | ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr, UndefBad); |
| 6884 | 6886 | if (!container_ptr_val) |
| 6885 | 6887 | return ira->codegen->builtin_types.entry_invalid; |
| 6886 | 6888 | |
| ... | ... | @@ -7148,7 +7150,7 @@ static TypeTableEntry *ir_analyze_instruction_set_debug_safety(IrAnalyze *ira, |
| 7148 | 7150 | TypeTableEntry *target_type = target_instruction->type_entry; |
| 7149 | 7151 | if (target_type->id == TypeTableEntryIdInvalid) |
| 7150 | 7152 | return ira->codegen->builtin_types.entry_invalid; |
| 7151 | | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction); |
| 7153 | ConstExprValue *target_val = ir_resolve_const(ira, target_instruction, UndefBad); |
| 7152 | 7154 | if (!target_val) |
| 7153 | 7155 | return ira->codegen->builtin_types.entry_invalid; |
| 7154 | 7156 | |
| ... | ... | @@ -7495,7 +7497,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 7495 | 7497 | TypeTableEntry *result_type = get_pointer_to_type(ira->codegen, child_type, false); |
| 7496 | 7498 | |
| 7497 | 7499 | if (instr_is_comptime(value)) { |
| 7498 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 7500 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 7499 | 7501 | if (!val) |
| 7500 | 7502 | return ira->codegen->builtin_types.entry_invalid; |
| 7501 | 7503 | ConstExprValue *maybe_val = val->data.x_ptr.base_ptr; |
| ... | ... | @@ -7579,7 +7581,7 @@ static IrInstruction *ir_analyze_enum_tag(IrAnalyze *ira, IrInstruction *source_ |
| 7579 | 7581 | } |
| 7580 | 7582 | |
| 7581 | 7583 | if (instr_is_comptime(value)) { |
| 7582 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 7584 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 7583 | 7585 | if (!val) |
| 7584 | 7586 | return ira->codegen->invalid_instruction; |
| 7585 | 7587 | |
| ... | ... | @@ -7606,7 +7608,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 7606 | 7608 | bool is_inline = ir_should_inline(&ira->new_irb) || switch_br_instruction->is_inline; |
| 7607 | 7609 | |
| 7608 | 7610 | if (is_inline || instr_is_comptime(target_value)) { |
| 7609 | | ConstExprValue *target_val = ir_resolve_const(ira, target_value); |
| 7611 | ConstExprValue *target_val = ir_resolve_const(ira, target_value, UndefBad); |
| 7610 | 7612 | if (!target_val) |
| 7611 | 7613 | return ir_unreach_error(ira); |
| 7612 | 7614 | |
| ... | ... | @@ -7626,7 +7628,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 7626 | 7628 | if (casted_case_value->type_entry->id == TypeTableEntryIdInvalid) |
| 7627 | 7629 | return ir_unreach_error(ira); |
| 7628 | 7630 | |
| 7629 | | ConstExprValue *case_val = ir_resolve_const(ira, casted_case_value); |
| 7631 | ConstExprValue *case_val = ir_resolve_const(ira, casted_case_value, UndefBad); |
| 7630 | 7632 | if (!case_val) |
| 7631 | 7633 | return ir_unreach_error(ira); |
| 7632 | 7634 | |
| ... | ... | @@ -7666,7 +7668,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 7666 | 7668 | if (casted_new_value->type_entry->id == TypeTableEntryIdInvalid) |
| 7667 | 7669 | continue; |
| 7668 | 7670 | |
| 7669 | | if (!ir_resolve_const(ira, casted_new_value)) |
| 7671 | if (!ir_resolve_const(ira, casted_new_value, UndefBad)) |
| 7670 | 7672 | continue; |
| 7671 | 7673 | |
| 7672 | 7674 | new_case->value = casted_new_value; |
| ... | ... | @@ -7776,7 +7778,7 @@ static TypeTableEntry *ir_analyze_instruction_static_eval(IrAnalyze *ira, |
| 7776 | 7778 | if (value->type_entry->id == TypeTableEntryIdInvalid) |
| 7777 | 7779 | return ira->codegen->builtin_types.entry_invalid; |
| 7778 | 7780 | |
| 7779 | | ConstExprValue *val = ir_resolve_const(ira, value); |
| 7781 | ConstExprValue *val = ir_resolve_const(ira, value, UndefBad); |
| 7780 | 7782 | if (!val) |
| 7781 | 7783 | return ira->codegen->builtin_types.entry_invalid; |
| 7782 | 7784 | |
| ... | ... | @@ -7949,7 +7951,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 7949 | 7951 | |
| 7950 | 7952 | if (const_val.special == ConstValSpecialStatic) { |
| 7951 | 7953 | if (outside_fn || field_value->static_value.special != ConstValSpecialRuntime) { |
| 7952 | | ConstExprValue *field_val = ir_resolve_const(ira, field_value); |
| 7954 | ConstExprValue *field_val = ir_resolve_const(ira, field_value, UndefOk); |
| 7953 | 7955 | if (!field_val) |
| 7954 | 7956 | return ira->codegen->builtin_types.entry_invalid; |
| 7955 | 7957 | |
| ... | ... | @@ -8030,7 +8032,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 8030 | 8032 | |
| 8031 | 8033 | if (const_val.special == ConstValSpecialStatic) { |
| 8032 | 8034 | if (outside_fn || arg_value->static_value.special != ConstValSpecialRuntime) { |
| 8033 | | ConstExprValue *elem_val = ir_resolve_const(ira, arg_value); |
| 8035 | ConstExprValue *elem_val = ir_resolve_const(ira, arg_value, UndefBad); |
| 8034 | 8036 | if (!elem_val) |
| 8035 | 8037 | return ira->codegen->builtin_types.entry_invalid; |
| 8036 | 8038 | |
| ... | ... | @@ -8494,8 +8496,8 @@ static TypeTableEntry *ir_analyze_instruction_div_exact(IrAnalyze *ira, IrInstru |
| 8494 | 8496 | if (casted_op1->static_value.special == ConstValSpecialStatic && |
| 8495 | 8497 | casted_op2->static_value.special == ConstValSpecialStatic) |
| 8496 | 8498 | { |
| 8497 | | ConstExprValue *op1_val = ir_resolve_const(ira, casted_op1); |
| 8498 | | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2); |
| 8499 | ConstExprValue *op1_val = ir_resolve_const(ira, casted_op1, UndefBad); |
| 8500 | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| 8499 | 8501 | assert(op1_val); |
| 8500 | 8502 | assert(op2_val); |
| 8501 | 8503 | |
| ... | ... | @@ -9140,7 +9142,7 @@ static TypeTableEntry *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruc |
| 9140 | 9142 | return ira->codegen->builtin_types.entry_invalid; |
| 9141 | 9143 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { |
| 9142 | 9144 | if (instr_is_comptime(value)) { |
| 9143 | | ConstExprValue *ptr_val = ir_resolve_const(ira, value); |
| 9145 | ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad); |
| 9144 | 9146 | if (!ptr_val) |
| 9145 | 9147 | return ira->codegen->builtin_types.entry_invalid; |
| 9146 | 9148 | ConstExprValue *err_union_val = ptr_val->data.x_ptr.base_ptr; |
| ... | ... | @@ -9181,7 +9183,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, |
| 9181 | 9183 | return ira->codegen->builtin_types.entry_invalid; |
| 9182 | 9184 | } else if (canon_type->id == TypeTableEntryIdErrorUnion) { |
| 9183 | 9185 | if (instr_is_comptime(value)) { |
| 9184 | | ConstExprValue *ptr_val = ir_resolve_const(ira, value); |
| 9186 | ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad); |
| 9185 | 9187 | if (!ptr_val) |
| 9186 | 9188 | return ira->codegen->builtin_types.entry_invalid; |
| 9187 | 9189 | ConstExprValue *err_union_val = ptr_val->data.x_ptr.base_ptr; |
| ... | ... | @@ -9226,7 +9228,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira, |
| 9226 | 9228 | TypeTableEntry *child_type = canon_type->data.error.child_type; |
| 9227 | 9229 | TypeTableEntry *result_type = get_pointer_to_type(ira->codegen, child_type, false); |
| 9228 | 9230 | if (instr_is_comptime(value)) { |
| 9229 | | ConstExprValue *ptr_val = ir_resolve_const(ira, value); |
| 9231 | ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad); |
| 9230 | 9232 | if (!ptr_val) |
| 9231 | 9233 | return ira->codegen->builtin_types.entry_invalid; |
| 9232 | 9234 | ConstExprValue *err_union_val = ptr_val->data.x_ptr.base_ptr; |