| ... | @@ -8657,6 +8657,12 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -8657,6 +8657,12 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 8657 | return Air.internedToRef((try mod.getCoerced(int_val, dest_ty)).toIntern()); | 8657 | return Air.internedToRef((try mod.getCoerced(int_val, dest_ty)).toIntern()); |
| 8658 | } | 8658 | } |
| 8659 | | 8659 | |
| | 8660 | if (dest_ty.intTagType(mod).zigTypeTag(mod) == .ComptimeInt) { |
| | 8661 | return sema.failWithNeededComptime(block, operand_src, .{ |
| | 8662 | .needed_comptime_reason = "value being casted to enum with 'comptime_int' tag type must be comptime-known", |
| | 8663 | }); |
| | 8664 | } |
| | 8665 | |
| 8660 | if (try sema.typeHasOnePossibleValue(dest_ty)) |opv| { | 8666 | if (try sema.typeHasOnePossibleValue(dest_ty)) |opv| { |
| 8661 | const result = Air.internedToRef(opv.toIntern()); | 8667 | const result = Air.internedToRef(opv.toIntern()); |
| 8662 | // The operand is runtime-known but the result is comptime-known. In | 8668 | // The operand is runtime-known but the result is comptime-known. In |