Commit eaf74f4f96
Changed files (2)
src
test
stage1
behavior
src/ir.cpp
@@ -23254,9 +23254,7 @@ static IrInstruction *ir_analyze_bit_cast(IrAnalyze *ira, IrInstruction *source_
return result;
}
- IrInstruction *result = ir_build_bit_cast_gen(ira, source_instr, value, dest_type);
- ir_assert(!(handle_is_ptr(dest_type) && !handle_is_ptr(src_type)), source_instr);
- return result;
+ return ir_build_bit_cast_gen(ira, source_instr, value, dest_type);
}
static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
test/stage1/behavior/bitcast.zig
@@ -95,20 +95,20 @@ test "@bitCast extern structs at runtime and comptime" {
comptime S.doTheTest();
}
-//test "bitcast packed struct to integer and back" {
-// const LevelUpMove = packed struct {
-// move_id: u9,
-// level: u7,
-// };
-// const S = struct {
-// fn doTheTest() void {
-// var move = LevelUpMove{ .move_id = 1, .level = 2 };
-// var v = @bitCast(u16, move);
-// var back_to_a_move = @bitCast(LevelUpMove, v);
-// expect(back_to_a_move.move_id == 1);
-// expect(back_to_a_move.level == 2);
-// }
-// };
-// S.doTheTest();
-// comptime S.doTheTest();
-//}
+test "bitcast packed struct to integer and back" {
+ const LevelUpMove = packed struct {
+ move_id: u9,
+ level: u7,
+ };
+ const S = struct {
+ fn doTheTest() void {
+ var move = LevelUpMove{ .move_id = 1, .level = 2 };
+ var v = @bitCast(u16, move);
+ var back_to_a_move = @bitCast(LevelUpMove, v);
+ expect(back_to_a_move.move_id == 1);
+ expect(back_to_a_move.level == 2);
+ }
+ };
+ S.doTheTest();
+ comptime S.doTheTest();
+}