aboutsummaryrefslogtreecommitdiff
path: root/test/cases/error.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-02-08 22:44:15 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-02-08 22:44:15 -0500
commit4b16874f04b7bae48a32da582af39667a3ef731d (patch)
tree82a0d6a7047f312ea014eeff22d959361c629745 /test/cases/error.zig
parentee982ae162901078458003fad169ddb1cf4d1d06 (diff)
downloadzig-4b16874f04b7bae48a32da582af39667a3ef731d.tar.gz
zig-4b16874f04b7bae48a32da582af39667a3ef731d.zip
add test for comptime err to int with only 1 member of set
Diffstat (limited to 'test/cases/error.zig')
-rw-r--r--test/cases/error.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cases/error.zig b/test/cases/error.zig
index 61e0b375a2..bb1366429b 100644
--- a/test/cases/error.zig
+++ b/test/cases/error.zig
@@ -140,3 +140,13 @@ test "syntax: nullable operator in front of error union operator" {
assert(?error!i32 == ?(error!i32));
}
}
+
+test "comptime err to int of error set with only 1 possible value" {
+ testErrToIntWithOnePossibleValue(error.A, u32(error.A));
+ comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A));
+}
+fn testErrToIntWithOnePossibleValue(x: error{A}, comptime value: u32) void {
+ if (u32(x) != value) {
+ @compileError("bad");
+ }
+}