mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 08:33:06 +00:00
parent
68c1d05917
commit
d353d5aef8
@ -18516,6 +18516,9 @@ static ZigType *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionF
|
||||
src_ptr_align = get_abi_alignment(ira->codegen, target->value.type);
|
||||
}
|
||||
|
||||
if ((err = type_resolve(ira->codegen, dest_child_type, ResolveStatusSizeKnown)))
|
||||
return ira->codegen->builtin_types.entry_invalid;
|
||||
|
||||
ZigType *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_child_type,
|
||||
src_ptr_const, src_ptr_volatile, PtrLenUnknown,
|
||||
src_ptr_align, 0, 0);
|
||||
|
@ -700,3 +700,13 @@ test "@intCast to a u0" {
|
||||
var y: u0 = @intCast(u0, x);
|
||||
assert(y == 0);
|
||||
}
|
||||
|
||||
test "@bytesToslice on a packed struct" {
|
||||
const F = packed struct {
|
||||
a: u8,
|
||||
};
|
||||
|
||||
var b = [1]u8{9};
|
||||
var f = @bytesToSlice(F, b);
|
||||
assert(f[0].a == 9);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user