aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/enum.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-09-02 16:08:20 +0300
committerVeikka Tuominen <git@vexu.eu>2022-09-02 17:57:11 +0300
commitf281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f (patch)
tree3a28628a95126b07fe7fa17e12ff3cbab1e9df65 /test/behavior/enum.zig
parenta9cdacff95a2a6f60945c7b2a299f9f66bd94ddb (diff)
downloadzig-f281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f.tar.gz
zig-f281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f.zip
Sema: improve behavior of comptime_int backed enums
Diffstat (limited to 'test/behavior/enum.zig')
-rw-r--r--test/behavior/enum.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig
index 517414780b..28c8785e64 100644
--- a/test/behavior/enum.zig
+++ b/test/behavior/enum.zig
@@ -1175,3 +1175,10 @@ test "Non-exhaustive enum with nonstandard int size behaves correctly" {
const E = enum(u15) { _ };
try expect(@sizeOf(E) == @sizeOf(u15));
}
+
+test "Non-exhaustive enum backed by comptime_int" {
+ const E = enum(comptime_int) { a, b, c, _ };
+ comptime var e: E = .a;
+ e = @intToEnum(E, 378089457309184723749);
+ try expect(@enumToInt(e) == 378089457309184723749);
+}