aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-12-05 18:09:22 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-12-05 18:09:22 -0500
commit63a2f9a8b2251ffdc37d5f28dfbd3f6be1bd7908 (patch)
tree799f7a95b9cda222a9242aaa5d866c38ace5effc /test/compile_errors.zig
parent74cea89fce2af41d2af7379ff526d7046c4d8d77 (diff)
downloadzig-63a2f9a8b2251ffdc37d5f28dfbd3f6be1bd7908.tar.gz
zig-63a2f9a8b2251ffdc37d5f28dfbd3f6be1bd7908.zip
fix casting integer literal to enum
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 5d13ed8d48..162109f4d8 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2684,4 +2684,16 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
,
".tmp_source.zig:11:13: error: switch on union which has no attached enum",
".tmp_source.zig:1:17: note: consider 'union(enum)' here");
+
+ cases.add("enum in field count range but not matching tag",
+ \\const Foo = enum(u32) {
+ \\ A = 10,
+ \\ B = 11,
+ \\};
+ \\export fn entry() {
+ \\ var x = Foo(0);
+ \\}
+ ,
+ ".tmp_source.zig:6:16: error: enum 'Foo' has no tag matching integer value 0",
+ ".tmp_source.zig:1:13: note: 'Foo' declared here");
}