mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 16:12:33 +00:00
8c8f6bfa64
Closes #13366
29 lines
832 B
Zig
29 lines
832 B
Zig
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);
|
|
}
|