zig/doc/langref/test_comptime_unreachable.zig

15 lines
353 B
Zig

const assert = @import("std").debug.assert;
test "type of unreachable" {
comptime {
// The type of unreachable is noreturn.
// However this assertion will still fail to compile because
// unreachable expressions are compile errors.
assert(@TypeOf(unreachable) == noreturn);
}
}
// test_error=unreachable code