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

const Set1 = error{
    A,
    B,
};
const Set2 = error{
    A,
    C,
};
pub fn main() void {
    foo(Set1.B);
}
fn foo(set1: Set1) void {
    const x: Set2 = @errorCast(set1);
    std.debug.print("value: {}\n", .{x});
}

// exe=fail