mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
27 lines
614 B
Plaintext
27 lines
614 B
Plaintext
#target=x86_64-linux-selfhosted
|
|
#target=x86_64-linux-cbe
|
|
#target=x86_64-windows-cbe
|
|
#target=wasm32-wasi-selfhosted
|
|
#update=initial version
|
|
#file=main.zig
|
|
const MyEnum = enum(u8) {
|
|
foo = 1,
|
|
bar = 2,
|
|
};
|
|
pub fn main() !void {
|
|
try std.io.getStdOut().writer().print("{}\n", .{@intFromEnum(MyEnum.foo)});
|
|
}
|
|
const std = @import("std");
|
|
#expect_stdout="1\n"
|
|
#update=remove enum field
|
|
#file=main.zig
|
|
const MyEnum = enum(u8) {
|
|
//foo = 1,
|
|
bar = 2,
|
|
};
|
|
pub fn main() !void {
|
|
try std.io.getStdOut().writer().print("{}\n", .{@intFromEnum(MyEnum.foo)});
|
|
}
|
|
const std = @import("std");
|
|
#expect_error=ignored
|