| ... | @@ -7330,7 +7330,7 @@ static void eval_const_expr_implicit_cast(CastOp cast_op, | ... | @@ -7330,7 +7330,7 @@ static void eval_const_expr_implicit_cast(CastOp cast_op, |
| 7330 | case CastOpResizeSlice: | 7330 | case CastOpResizeSlice: |
| 7331 | case CastOpBytesToSlice: | 7331 | case CastOpBytesToSlice: |
| 7332 | // can't do it | 7332 | // can't do it |
| 7333 | break; | 7333 | zig_unreachable(); |
| 7334 | case CastOpIntToFloat: | 7334 | case CastOpIntToFloat: |
| 7335 | { | 7335 | { |
| 7336 | assert(new_type->id == TypeTableEntryIdFloat); | 7336 | assert(new_type->id == TypeTableEntryIdFloat); |
| ... | @@ -7366,7 +7366,9 @@ static void eval_const_expr_implicit_cast(CastOp cast_op, | ... | @@ -7366,7 +7366,9 @@ static void eval_const_expr_implicit_cast(CastOp cast_op, |
| 7366 | static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, | 7366 | static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, |
| 7367 | TypeTableEntry *wanted_type, CastOp cast_op, bool need_alloca) | 7367 | TypeTableEntry *wanted_type, CastOp cast_op, bool need_alloca) |
| 7368 | { | 7368 | { |
| 7369 | if (value->value.special != ConstValSpecialRuntime) { | 7369 | if (value->value.special != ConstValSpecialRuntime && |
| | 7370 | cast_op != CastOpResizeSlice && cast_op != CastOpBytesToSlice) |
| | 7371 | { |
| 7370 | IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope, | 7372 | IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope, |
| 7371 | source_instr->source_node, wanted_type); | 7373 | source_instr->source_node, wanted_type); |
| 7372 | eval_const_expr_implicit_cast(cast_op, &value->value, value->value.type, | 7374 | eval_const_expr_implicit_cast(cast_op, &value->value, value->value.type, |
| ... | @@ -8166,7 +8168,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -8166,7 +8168,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 8166 | } | 8168 | } |
| 8167 | } | 8169 | } |
| 8168 | | 8170 | |
| 8169 | // expliict cast from &const [N]T to []const T | 8171 | // explicit cast from &const [N]T to []const T |
| 8170 | if (is_slice(wanted_type) && | 8172 | if (is_slice(wanted_type) && |
| 8171 | actual_type->id == TypeTableEntryIdPointer && | 8173 | actual_type->id == TypeTableEntryIdPointer && |
| 8172 | actual_type->data.pointer.is_const && | 8174 | actual_type->data.pointer.is_const && |