diff options
| author | IntegratedQuantum <jahe788@gmail.com> | 2023-06-19 21:39:35 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-06-20 20:09:28 -0700 |
| commit | 3267eb3a28f6c747772a40beedac14f5feae814f (patch) | |
| tree | 7efb8be32c6a30a214087faca4c6c1012bbeff95 /test/behavior/enum.zig | |
| parent | b77679039fd40aa1693781f99ac89f2dc705e5c2 (diff) | |
| download | zig-3267eb3a28f6c747772a40beedac14f5feae814f.tar.gz zig-3267eb3a28f6c747772a40beedac14f5feae814f.zip | |
Fix @enumToInt and @tagName for auto-numbered enums with signed tag type.
Diffstat (limited to 'test/behavior/enum.zig')
| -rw-r--r-- | test/behavior/enum.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig index 12926800e3..4280a954dc 100644 --- a/test/behavior/enum.zig +++ b/test/behavior/enum.zig @@ -812,6 +812,11 @@ test "signed integer as enum tag" { try expect(@intFromEnum(SignedEnum.A2) == 1); } +test "int to enum with signed tag type" { + const E = enum(i32) { a, b, c }; + try expect(@intToEnum(E, 0) == .a); +} + test "enum with one member and custom tag type" { const E = enum(u2) { One, |
