1#todo "it'd be great if we could actually check that no analysis happened!"
2#exe {
3-Mroot=main.zig
4#}
5
6#write main.zig {
7pub fn main() void {
8 const ptr: *const O = @ptrFromInt(0x1000);
9 _ = ptr;
10}
11const S = struct { foo: u32, nested: struct { x: u16 } };
12const U = union(enum) { a, b, c: S };
13const E = enum(u8) { a = @typeInfo(U).@"union".field_names.len, b = 0, c };
14const O = opaque {
15 comptime {
16 _ = @as(S, undefined);
17 _ = @as(U, undefined);
18 _ = @as(E, undefined);
19 const Wrapper = struct { val: S };
20 const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
21 _ = wrapper;
22 }
23};
24#}
25#update
26#check stdout
27
28#write main.zig {
29pub fn main() void {
30 const ptr: *const O = @ptrFromInt(0x1000);
31 _ = ptr;
32}
33const S = struct { foo: u32, nested: struct { x: u16 } };
34const U = union(enum) { a, b, c: S };
35const E = enum(u8) { a = @typeInfo(U).@"union".field_names.len, b = 0, c };
36const O = opaque {
37 comptime {
38 _ = @as(S, undefined);
39 _ = @as(U, undefined);
40 _ = @as(E, undefined);
41 const Wrapper = struct { val: S };
42 const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
43 _ = wrapper;
44 }
45};
46#}
47#update "do literally nothing"
48#check stdout