From 3ee9d06cbdb6bcaf561e7215c4c103c7ad65a72d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 20 Feb 2019 22:40:41 -0500 Subject: packed structs support comptime bitcasting * `type_size_store` is no longer a thing. loading and storing a pointer to a value may dereference up to `@sizeOf(T)` bytes, even for integers such as `u24`. * fix `types_have_same_zig_comptime_repr` to not think that the same `ZigTypeId` means the `ConstExprValue` neccesarily has the same representation. * implement `buf_write_value_bytes` and `buf_read_value_bytes` for `ContainerLayoutPacked` closes #1120 --- test/compile_errors.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/compile_errors.zig') diff --git a/test/compile_errors.zig b/test/compile_errors.zig index a9c748bcda..07e677b8ed 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -318,12 +318,12 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "reading past end of pointer casted array", \\comptime { \\ const array = "aoeu"; - \\ const slice = array[2..]; + \\ const slice = array[1..]; \\ const int_ptr = @ptrCast(*const u24, slice.ptr); \\ const deref = int_ptr.*; \\} , - ".tmp_source.zig:5:26: error: attempt to read 3 bytes from [4]u8 at index 2 which is 2 bytes", + ".tmp_source.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes", ); cases.add( -- cgit v1.2.3