diff options
Diffstat (limited to 'test/behavior/struct.zig')
| -rw-r--r-- | test/behavior/struct.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 393f23ec6e..f6fb45f46b 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -995,6 +995,24 @@ test "struct with union field" { try expect(True.kind.Bool); } +test "struct with 0-length union array field" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO + + const U = union { + a: u32, + b: u64, + }; + + const S = struct { + zero_length: [0]U, + }; + + var s: S = undefined; + try expectEqual(@as(usize, 0), s.zero_length.len); +} + test "type coercion of anon struct literal to struct" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
