mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
parent
2936602566
commit
508294e9be
@ -284,3 +284,12 @@ test "@ptrCast undefined value at comptime" {
|
||||
_ = x;
|
||||
}
|
||||
}
|
||||
|
||||
test "comptime @ptrCast with packed struct leaves value unmodified" {
|
||||
const S = packed struct { three: u3 };
|
||||
const st: S = .{ .three = 6 };
|
||||
try expect(st.three == 6);
|
||||
const p: *const [1]u3 = @ptrCast(&st);
|
||||
try expect(p.*[0] == 6);
|
||||
try expect(st.three == 6);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user