| author | |
| committer | |
| log | 6f250f568a5d5dd667b9f290ed8afc9412175b1d |
| tree | 38eb7603a54d2dac1db55d833ef4f706fa41531e |
| parent | 844e05f619d62c1c2a332c1effa3ab6c211b3062 |
See #3022 files changed, 12 insertions(+), 3 deletions(-)
test/cases/enum.zig+5-2| ... | ... | @@ -9,8 +9,7 @@ test "enum type" { |
| 9 | 9 | assert(bar == Bar.B); |
| 10 | 10 | assert(@memberCount(Foo) == 3); |
| 11 | 11 | assert(@memberCount(Bar) == 4); |
| 12 | const expected_foo_size = 16 + @sizeOf(usize); | |
| 13 | assert(@sizeOf(Foo) == expected_foo_size); | |
| 12 | assert(@sizeOf(Foo) == @sizeOf(FooNoVoid)); | |
| 14 | 13 | assert(@sizeOf(Bar) == 1); |
| 15 | 14 | } |
| 16 | 15 | |
| ... | ... | @@ -30,6 +29,10 @@ const Foo = enum { |
| 30 | 29 | Two: Point, |
| 31 | 30 | Three: void, |
| 32 | 31 | }; |
| 32 | const FooNoVoid = enum { | |
| 33 | One: i32, | |
| 34 | Two: Point, | |
| 35 | }; | |
| 33 | 36 | const Bar = enum { |
| 34 | 37 | A, |
| 35 | 38 | B, |
test/cases/struct.zig+7-1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | |
| 3 | 4 | const StructWithNoFields = struct { |
| 4 | 5 | fn add(a: i32, b: i32) -> i32 { a + b } |
| ... | ... | @@ -257,7 +258,12 @@ test "packed struct 24bits" { |
| 257 | 258 | assert(@sizeOf(Foo96Bits) == 12); |
| 258 | 259 | } |
| 259 | 260 | |
| 260 | var value = Foo96Bits { | |
| 261 | // TODO workaround for LLVM bug on windows | |
| 262 | // http://lists.llvm.org/pipermail/llvm-dev/2017-September/117864.html | |
| 263 | const align_bytes = if (builtin.os == builtin.Os.windows and | |
| 264 | builtin.arch == builtin.Arch.x86_64) 32 else @alignOf(Foo96Bits); | |
| 265 | ||
| 266 | var value align(align_bytes) = Foo96Bits { | |
| 261 | 267 | .a = 0, |
| 262 | 268 | .b = 0, |
| 263 | 269 | .c = 0, |