zig/test/behavior/bugs/11165.zig
Mitchell Hashimoto 67647154c1
stage2: apply fix for #11165 to codegen.zig for native backends
Co-authored-by: Cody Tapscott <topolarity@tapscott.me>
2022-03-14 20:00:17 -07:00

49 lines
956 B
Zig

const builtin = @import("builtin");
test "bytes" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
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;
var u_2 = U{ .s = s_1 };
_ = u_2;
}
test "aggregate" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
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;
var u_2 = U{ .s = s_1 };
_ = u_2;
}