| author | |
| committer | |
| log | af7e945a7dc00a2a5055d9770b9ecda253d64a8e |
| tree | eea75368e3cf4a065a0e261f99a584d3a9beea68 |
| parent | 2f6a01d0c39542e7d88c9af14e869b820fd156cc |
4 files changed, 15 insertions(+), 1 deletions(-)
src/type.zig+1-1| ... | ... | @@ -5177,7 +5177,7 @@ pub const Type = extern union { |
| 5177 | 5177 | |
| 5178 | 5178 | const field = it.struct_obj.fields.values()[it.field]; |
| 5179 | 5179 | defer it.field += 1; |
| 5180 | if (!field.ty.hasRuntimeBits()) | |
| 5180 | if (!field.ty.hasRuntimeBits() or field.is_comptime) | |
| 5181 | 5181 | return FieldOffset{ .field = it.field, .offset = it.offset }; |
| 5182 | 5182 | |
| 5183 | 5183 | const field_align = field.normalAlignment(it.target); |
test/behavior/align.zig+4| ... | ... | @@ -55,6 +55,10 @@ test "alignment of struct with pointer has same alignment as usize" { |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | test "alignment and size of structs with 128-bit fields" { |
| 58 | if (builtin.zig_backend == .stage1) { | |
| 59 | // stage1 gets the wrong answer for a lot of targets | |
| 60 | return error.SkipZigTest; | |
| 61 | } | |
| 58 | 62 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 59 | 63 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 60 | 64 |
test/behavior/bitcast.zig+4| ... | ... | @@ -120,6 +120,10 @@ test "bitcast generates a temporary value" { |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | test "@bitCast packed structs at runtime and comptime" { |
| 123 | if (builtin.zig_backend == .stage1) { | |
| 124 | // stage1 gets the wrong answer for a lot of targets | |
| 125 | return error.SkipZigTest; | |
| 126 | } | |
| 123 | 127 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 124 | 128 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 125 | 129 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
test/behavior/struct.zig+6| ... | ... | @@ -500,6 +500,10 @@ const Bitfields = packed struct { |
| 500 | 500 | }; |
| 501 | 501 | |
| 502 | 502 | test "packed struct fields are ordered from LSB to MSB" { |
| 503 | if (builtin.zig_backend == .stage1) { | |
| 504 | // stage1 gets the wrong answer for a lot of targets | |
| 505 | return error.SkipZigTest; | |
| 506 | } | |
| 503 | 507 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 504 | 508 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 505 | 509 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| ... | ... | @@ -971,6 +975,8 @@ test "comptime struct field" { |
| 971 | 975 | comptime b: i32 = 1234, |
| 972 | 976 | }; |
| 973 | 977 | |
| 978 | comptime std.debug.assert(@sizeOf(T) == 4); | |
| 979 | ||
| 974 | 980 | var foo: T = undefined; |
| 975 | 981 | comptime try expect(foo.b == 1234); |
| 976 | 982 | } |