const Set1 = error{ A, B, }; const Set2 = error{ A, C, }; comptime { _ = @as(Set2, @errorCast(Set1.B)); } // test_error='error.B' not a member of error set 'error{A,C}'