aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-21 14:44:24 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-21 14:44:24 -0500
commit5b7ae86af488745fc93cdbaff11bf2438938274a (patch)
tree1848e0b2e96ea622f4a6fc8f1bb31c7721331100 /test/compile_errors.zig
parent517e8ea4269fb832f29d9eab642d57f1a8371149 (diff)
downloadzig-5b7ae86af488745fc93cdbaff11bf2438938274a.tar.gz
zig-5b7ae86af488745fc93cdbaff11bf2438938274a.zip
fix crash when switching on enum with 1 field and no switch prongs
closes #712
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 22d1d65cc7..d3c0c7cfee 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1,6 +1,15 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) {
+ cases.add("switch on enum with 1 field with no prongs",
+ \\const Foo = enum { M };
+ \\
+ \\export fn entry() {
+ \\ var f = Foo.M;
+ \\ switch (f) {}
+ \\}
+ , ".tmp_source.zig:5:5: error: enumeration value 'Foo.M' not handled in switch");
+
cases.add("shift by negative comptime integer",
\\comptime {
\\ var a = 1 >> -1;