| author | |
| committer | |
| log | 0914e0a4ecabc1c9f4b4a8675955ab634065449e |
| tree | 45ef6d52f6385feaf867b38d03ecfe7162590639 |
| parent | 31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415 |
2 files changed, 4 insertions(+), 3 deletions(-)
src/link/Dwarf.zig+4-1| ... | ... | @@ -405,8 +405,11 @@ pub const DeclState = struct { |
| 405 | 405 | const value: u64 = if (values) |vals| value: { |
| 406 | 406 | if (vals.count() == 0) break :value @intCast(u64, field_i); // auto-numbered |
| 407 | 407 | const value = vals.keys()[field_i]; |
| 408 | // TODO do not assume a 64bit enum value - could be bigger. | |
| 409 | // See https://github.com/ziglang/zig/issues/645 | |
| 408 | 410 | var int_buffer: Value.Payload.U64 = undefined; |
| 409 | break :value value.enumToInt(ty, &int_buffer).toUnsignedInt(target); | |
| 411 | const field_int_val = value.enumToInt(ty, &int_buffer); | |
| 412 | break :value @bitCast(u64, field_int_val.toSignedInt()); | |
| 410 | 413 | } else @intCast(u64, field_i); |
| 411 | 414 | mem.writeInt(u64, dbg_info_buffer.addManyAsArrayAssumeCapacity(8), value, target_endian); |
| 412 | 415 | } |
test/behavior/enum.zig-2| ... | ... | @@ -1146,8 +1146,6 @@ test "size of enum with only one tag which has explicit integer tag type" { |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | test "switch on an extern enum with negative value" { |
| 1149 | // TODO x86, wasm backends fail because they assume that enum tag types are unsigned | |
| 1150 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1151 | 1149 | if (@import("builtin").zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 1152 | 1150 | |
| 1153 | 1151 | const Foo = enum(c_int) { |