blob bf4dee84 (489B) - Raw
1 const std = @import("std"); 2 3 pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { 4 _ = stack_trace; 5 if (std.mem.eql(u8, message, "invalid error code")) { 6 std.process.exit(0); 7 } 8 std.process.exit(1); 9 } 10 const Set1 = error{A, B}; 11 const Set2 = error{A, C}; 12 pub fn main() !void { 13 foo(Set1.B) catch {}; 14 return error.TestFailed; 15 } 16 fn foo(set1: Set1) Set2 { 17 return @errSetCast(Set2, set1); 18 } 19 // run 20 // backend=llvm 21 // target=native