| author | |
| committer | |
| log | 1364cba90d41cb2f33380b23d534aaddbd6ceff2 |
| tree | 616dbe8650002be58822d75c70c4d945e378d195 |
| parent | be4c4ce2787537f860c8578eb9e497f66c2e9baf |
| signature |
3 files changed, 1 insertions(+), 38 deletions(-)
test/behavior/array.zig-22| ... | @@ -539,28 +539,6 @@ test "sentinel element count towards the ABI size calculation" { | ... | @@ -539,28 +539,6 @@ test "sentinel element count towards the ABI size calculation" { |
| 539 | try comptime S.doTheTest(); | 539 | try comptime S.doTheTest(); |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | test "zero-sized array with recursive type definition" { | ||
| 543 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 544 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | ||
| 545 | |||
| 546 | const U = struct { | ||
| 547 | fn foo(comptime T: type, comptime n: usize) type { | ||
| 548 | return struct { | ||
| 549 | s: [n]T, | ||
| 550 | x: usize = n, | ||
| 551 | }; | ||
| 552 | } | ||
| 553 | }; | ||
| 554 | |||
| 555 | const S = struct { | ||
| 556 | list: U.foo(@This(), 0), | ||
| 557 | }; | ||
| 558 | |||
| 559 | var t: S = .{ .list = .{ .s = undefined } }; | ||
| 560 | _ = &t; | ||
| 561 | try expect(@as(usize, 0) == t.list.x); | ||
| 562 | } | ||
| 563 | |||
| 564 | test "type coercion of anon struct literal to array" { | 542 | test "type coercion of anon struct literal to array" { |
| 565 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 543 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 566 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 544 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
test/behavior/sizeof_and_typeof.zig-15| ... | @@ -120,21 +120,6 @@ test "@bitOffsetOf" { | ... | @@ -120,21 +120,6 @@ test "@bitOffsetOf" { |
| 120 | try expect(@offsetOf(A, "g") * 8 == @bitOffsetOf(A, "g")); | 120 | try expect(@offsetOf(A, "g") * 8 == @bitOffsetOf(A, "g")); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | test "@sizeOf(T) == 0 doesn't force resolving struct size" { | ||
| 124 | const S = struct { | ||
| 125 | const Foo = struct { | ||
| 126 | y: if (@sizeOf(Foo) == 0) u64 else u32, | ||
| 127 | }; | ||
| 128 | const Bar = struct { | ||
| 129 | x: i32, | ||
| 130 | y: if (0 == @sizeOf(Bar)) u64 else u32, | ||
| 131 | }; | ||
| 132 | }; | ||
| 133 | |||
| 134 | try expect(@sizeOf(S.Foo) == 4); | ||
| 135 | try expect(@sizeOf(S.Bar) == 8); | ||
| 136 | } | ||
| 137 | |||
| 138 | test "@TypeOf() has no runtime side effects" { | 123 | test "@TypeOf() has no runtime side effects" { |
| 139 | const S = struct { | 124 | const S = struct { |
| 140 | fn foo(comptime T: type, ptr: *T) T { | 125 | fn foo(comptime T: type, ptr: *T) T { |
test/behavior/struct_contains_slice_of_itself.zig+1-1| ... | @@ -8,7 +8,7 @@ const Node = struct { | ... | @@ -8,7 +8,7 @@ const Node = struct { |
| 8 | 8 | ||
| 9 | const NodeAligned = struct { | 9 | const NodeAligned = struct { |
| 10 | payload: i32, | 10 | payload: i32, |
| 11 | children: []align(@alignOf(NodeAligned)) NodeAligned, | 11 | children: []align(1) NodeAligned, |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | test "struct contains slice of itself" { | 14 | test "struct contains slice of itself" { |