diff options
| author | Evin Yulo <yujiri@disroot.org> | 2022-12-10 02:50:37 +0000 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-16 18:21:56 +0200 |
| commit | 8c8f6bfa642bf69a997bb64dc9bc7c89f7b86c3c (patch) | |
| tree | f113433b25d47d2415e6d75a5e402f2242677a49 /test/behavior/bugs | |
| parent | b5d1df091b3c2b8943a1bdece5d48a4355489a4e (diff) | |
| download | zig-8c8f6bfa642bf69a997bb64dc9bc7c89f7b86c3c.tar.gz zig-8c8f6bfa642bf69a997bb64dc9bc7c89f7b86c3c.zip | |
Add test for #13366
Closes #13366
Diffstat (limited to 'test/behavior/bugs')
| -rw-r--r-- | test/behavior/bugs/13366.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/behavior/bugs/13366.zig b/test/behavior/bugs/13366.zig new file mode 100644 index 0000000000..ff90ee00c3 --- /dev/null +++ b/test/behavior/bugs/13366.zig @@ -0,0 +1,28 @@ +const builtin = @import("builtin"); +const std = @import("std"); +const expect = std.testing.expect; + +const ComptimeReason = union(enum) { + c_import: struct { + a: u32, + }, +}; + +const Block = struct { + reason: ?*const ComptimeReason, +}; + +test { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + + var a: u32 = 16; + var reason = .{ .c_import = .{ .a = a } }; + var block = Block{ + .reason = &reason, + }; + try expect(block.reason.?.c_import.a == 16); +} |
