test_comptime_unreachable.zig (353B) - Raw
1 const assert = @import("std").debug.assert; 2 3 test "type of unreachable" { 4 comptime { 5 // The type of unreachable is noreturn. 6 7 // However this assertion will still fail to compile because 8 // unreachable expressions are compile errors. 9 10 assert(@TypeOf(unreachable) == noreturn); 11 } 12 } 13 14 // test_error=unreachable code