aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-01-02 17:37:27 -0500
committerGitHub <noreply@github.com>2023-01-02 17:37:27 -0500
commitdf5fcf5432bc25faf8e981c3ce74820b5f1ea3c7 (patch)
tree0ca9f031a799dfc43363fa87a6e1b5cf3140f690 /test/cases/compile_errors
parent0b99c83c21f9899cb7e8fb876caf0b005b5121c7 (diff)
parentb048fa4f1377c84327f74fd4ecd5b03141e68e36 (diff)
downloadzig-df5fcf5432bc25faf8e981c3ce74820b5f1ea3c7.tar.gz
zig-df5fcf5432bc25faf8e981c3ce74820b5f1ea3c7.zip
Merge pull request #14159 from Vexu/err-fix
Sema: prevent spurious "depends on itself" errors
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/intToEnum_on_non-exhaustive_enums_checks_int_in_range.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/compile_errors/intToEnum_on_non-exhaustive_enums_checks_int_in_range.zig b/test/cases/compile_errors/intToEnum_on_non-exhaustive_enums_checks_int_in_range.zig
new file mode 100644
index 0000000000..b05c9f35d9
--- /dev/null
+++ b/test/cases/compile_errors/intToEnum_on_non-exhaustive_enums_checks_int_in_range.zig
@@ -0,0 +1,11 @@
+pub export fn entry() void {
+ const E = enum(u3) { a, b, c, _ };
+ @compileLog(@intToEnum(E, 100));
+}
+
+// error
+// target=native
+// backend=stage2
+//
+// :3:17: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E'
+// :2:15: note: enum declared here