aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-18 17:15:36 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-18 17:15:36 -0500
commit0fc645ab7084c1812d367583b37218359b21c02c (patch)
treeb156e5bdc445b8b9b3b7763c358a195cf9438a1f /test/compile_errors.zig
parent0b8f19fcba04cde35ca4831f37f8249d51da9432 (diff)
downloadzig-0fc645ab7084c1812d367583b37218359b21c02c.tar.gz
zig-0fc645ab7084c1812d367583b37218359b21c02c.zip
emit a compile error for @panic called at compile time
closes #706
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 6b2ea545ed..13373f4737 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1,6 +1,14 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) {
+ cases.add("@panic called at compile time",
+ \\export fn entry() {
+ \\ comptime {
+ \\ @panic("aoeu");
+ \\ }
+ \\}
+ , "error: encountered @panic at compile-time");
+
cases.add("wrong return type for main",
\\pub fn main() -> f32 { }
, "error: expected return type of main to be 'u8', 'noreturn', 'void', or '%void'");