runtime_invalid_error_set_cast.zig (264B) - Raw
1 const std = @import("std"); 2 3 const Set1 = error{ 4 A, 5 B, 6 }; 7 const Set2 = error{ 8 A, 9 C, 10 }; 11 pub fn main() void { 12 foo(Set1.B); 13 } 14 fn foo(set1: Set1) void { 15 const x: Set2 = @errorCast(set1); 16 std.debug.print("value: {}\n", .{x}); 17 } 18 19 // exe=fail