mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 17:12:31 +00:00
12 lines
231 B
Zig
12 lines
231 B
Zig
|
pub fn main() void {
|
||
|
const a: anyerror!comptime_int = 42;
|
||
|
const b: *const comptime_int = &(a catch unreachable);
|
||
|
assert(b.* == 42);
|
||
|
}
|
||
|
fn assert(b: bool) void {
|
||
|
if (!b) unreachable; // assertion failure
|
||
|
}
|
||
|
|
||
|
// run
|
||
|
//
|