aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/runtime_invalid_enum_cast.zig
blob: f4a44645d55a38fe5d9e8dac4a7abdc2e9877b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const std = @import("std");

const Foo = enum {
    a,
    b,
    c,
};

pub fn main() void {
    var a: u2 = 3;
    _ = &a;
    const b: Foo = @enumFromInt(a);
    std.debug.print("value: {s}\n", .{@tagName(b)});
}

// exe=fail