diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-11 19:57:41 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-11 20:30:16 +0300 |
| commit | 122c76a1670e4b925ccdabaa771f59e5df6d43aa (patch) | |
| tree | 3649a70bb7e967af3818d64c250e413a04c107f7 /test/behavior | |
| parent | d00da05ecbeca36e8ca25dcb1238bf98b38081a5 (diff) | |
| download | zig-122c76a1670e4b925ccdabaa771f59e5df6d43aa.tar.gz zig-122c76a1670e4b925ccdabaa771f59e5df6d43aa.zip | |
Sema: allow `void` as an extern union field & fix invalid extern unions
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/union.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/behavior/union.zig b/test/behavior/union.zig index be01b3a048..caa78be977 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -84,18 +84,19 @@ test "comptime union field access" { const FooExtern = extern union { int: i32, - str: struct { - slice: []const u8, + str: extern struct { + slice: [*:0]const u8, }, }; test "basic extern unions" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var foo = FooExtern{ .int = 1 }; try expect(foo.int == 1); foo.str.slice = "Well"; - try expect(std.mem.eql(u8, foo.str.slice, "Well")); + try expect(std.mem.eql(u8, std.mem.sliceTo(foo.str.slice, 0), "Well")); } const ExternPtrOrInt = extern union { |
