diff options
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/bugs/11165.zig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/behavior/bugs/11165.zig b/test/behavior/bugs/11165.zig new file mode 100644 index 0000000000..d253c17b67 --- /dev/null +++ b/test/behavior/bugs/11165.zig @@ -0,0 +1,42 @@ +const builtin = @import("builtin"); + +test "bytes" { + const S = struct { + a: u32, + c: [5]u8, + }; + + const U = union { + s: S, + }; + + const s_1 = S{ + .a = undefined, + .c = "12345".*, // this caused problems + }; + _ = s_1; + + const u_2 = U{ .s = s_1 }; + _ = u_2; +} + +test "aggregate" { + const S = struct { + a: u32, + c: [5]u8, + }; + + const U = union { + s: S, + }; + + const c = [5:0]u8{ 1, 2, 3, 4, 5 }; + const s_1 = S{ + .a = undefined, + .c = c, // this caused problems + }; + _ = s_1; + + const u_2 = U{ .s = s_1 }; + _ = u_2; +} |
