| author | |
| committer | |
| log | 3dbed54294bc6769f64fc8bd23b98605d009677c |
| tree | 526bd9f01b83185dad4bbf91b5a238c43d6aa7a9 |
| parent | 07c5e906010e85d7e6560dc3ed398d7e4b284ec0 |
| signature |
closes #30422 files changed, 11 insertions(+), 0 deletions(-)
src/ir.cpp+3| ... | ... | @@ -14802,6 +14802,9 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 14802 | 14802 | return ira->codegen->invalid_instruction; |
| 14803 | 14803 | } |
| 14804 | 14804 | uint64_t parent_ptr_align = get_ptr_align(ira->codegen, parent_ptr_type); |
| 14805 | if ((err = type_resolve(ira->codegen, value_type, ResolveStatusAlignmentKnown))) { | |
| 14806 | return ira->codegen->invalid_instruction; | |
| 14807 | } | |
| 14805 | 14808 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, value_type, |
| 14806 | 14809 | parent_ptr_type->data.pointer.is_const, parent_ptr_type->data.pointer.is_volatile, PtrLenSingle, |
| 14807 | 14810 | parent_ptr_align, 0, 0, parent_ptr_type->data.pointer.allow_zero); |
test/stage1/behavior/bitcast.zig+8| ... | ... | @@ -131,3 +131,11 @@ test "bitcast literal [4]u8 param to u32" { |
| 131 | 131 | const ip = @bitCast(u32, [_]u8{ 255, 255, 255, 255 }); |
| 132 | 132 | expect(ip == maxInt(u32)); |
| 133 | 133 | } |
| 134 | ||
| 135 | test "bitcast packed struct literal to byte" { | |
| 136 | const Foo = packed struct { | |
| 137 | value: u8, | |
| 138 | }; | |
| 139 | const casted = @bitCast(u8, Foo{ .value = 0xF }); | |
| 140 | expect(casted == 0xf); | |
| 141 | } |