| author | |
| committer | |
| log | 508294e9be2173b47c2e4d2fb1c52c41fcfcbc1c |
| tree | d65eab9ac9665dffb37a8eb98957a3ce3faa38c5 |
| parent | 2936602566c5c460abae350a6d59c1da0e0989ee |
closes #99121 files changed, 9 insertions(+), 0 deletions(-)
test/behavior/ptrcast.zig+9| ... | ... | @@ -284,3 +284,12 @@ test "@ptrCast undefined value at comptime" { |
| 284 | 284 | _ = x; |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | ||
| 288 | test "comptime @ptrCast with packed struct leaves value unmodified" { | |
| 289 | const S = packed struct { three: u3 }; | |
| 290 | const st: S = .{ .three = 6 }; | |
| 291 | try expect(st.three == 6); | |
| 292 | const p: *const [1]u3 = @ptrCast(&st); | |
| 293 | try expect(p.*[0] == 6); | |
| 294 | try expect(st.three == 6); | |
| 295 | } |