zig/doc/langref/test_comptime_invalid_error_code.zig

9 lines
210 B
Zig

comptime {
const err = error.AnError;
const number = @intFromError(err) + 10;
const invalid_err = @errorFromInt(number);
_ = invalid_err;
}
// test_error=integer value '11' represents no error