aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_comptime_unreachable.zig
blob: 677a3dff3c125e894d4fe3404768d8bda1b69e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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