mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 19:00:52 +08:00
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
#todo {
|
|
it'd be great if we could actually check that no analysis happened!
|
|
#}
|
|
#exe {
|
|
-Mroot=main.zig
|
|
#}
|
|
|
|
#write main.zig {
|
|
pub fn main() void {
|
|
const ptr: *const O = @ptrFromInt(0x1000);
|
|
_ = ptr;
|
|
}
|
|
const S = struct { foo: u32, nested: struct { x: u16 } };
|
|
const U = union(enum) { a, b, c: S };
|
|
const E = enum(u8) { a = @typeInfo(U).@"union".field_names.len, b = 0, c };
|
|
const O = opaque {
|
|
comptime {
|
|
_ = @as(S, undefined);
|
|
_ = @as(U, undefined);
|
|
_ = @as(E, undefined);
|
|
const Wrapper = struct { val: S };
|
|
const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
|
|
_ = wrapper;
|
|
}
|
|
};
|
|
#}
|
|
#update
|
|
#check stdout {
|
|
#}
|
|
|
|
#write main.zig {
|
|
pub fn main() void {
|
|
const ptr: *const O = @ptrFromInt(0x1000);
|
|
_ = ptr;
|
|
}
|
|
const S = struct { foo: u32, nested: struct { x: u16 } };
|
|
const U = union(enum) { a, b, c: S };
|
|
const E = enum(u8) { a = @typeInfo(U).@"union".field_names.len, b = 0, c };
|
|
const O = opaque {
|
|
comptime {
|
|
_ = @as(S, undefined);
|
|
_ = @as(U, undefined);
|
|
_ = @as(E, undefined);
|
|
const Wrapper = struct { val: S };
|
|
const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
|
|
_ = wrapper;
|
|
}
|
|
};
|
|
#}
|
|
#update {
|
|
do literally nothing#}
|
|
#check stdout {
|
|
#}
|