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 /src/InternPool.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 'src/InternPool.zig')
| -rw-r--r-- | src/InternPool.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index 221b56b88a..a385702c43 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -448,7 +448,11 @@ pub const Key = union(enum) { if (x >= self.names.len) return null; return @intCast(u32, x); }, - .i64, .big_int => return null, // out of range + .i64 => |x| { + if (x >= self.names.len or x < 0) return null; + return @intCast(u32, x); + }, + .big_int => return null, // out of range .lazy_align, .lazy_size => unreachable, } } |
