| author | |
| committer | |
| log | a221b2fbf2829e2e8ba5ecd2d7569e619a66d69b |
| tree | f5290a3a9e0374966b5593174696975fd9fb6d3d |
| parent | e62aac3ec4b21da20d7c57d937e508f2929138d0 |
It currently prints as:
:3:18: error: untagged union 'Zcu.LazySrcLoc{ .base_node_inst = InternPool.TrackedInst.Index(104), .offset = Zcu.LazySrcLoc.Offset{ .node_offset = Zcu.LazySrcLoc.Offset.TracedOffset{ .x = -2, .trace = (value tracing disabled) } } }' cannot be converted to integer2 files changed, 12 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | @@ -8999,7 +8999,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -8999,7 +8999,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 8999 | block, | 8999 | block, |
| 9000 | operand_src, | 9000 | operand_src, |
| 9001 | "untagged union '{}' cannot be converted to integer", | 9001 | "untagged union '{}' cannot be converted to integer", |
| 9002 | .{src}, | 9002 | .{operand_ty.fmt(pt)}, |
| 9003 | ); | 9003 | ); |
| 9004 | }; | 9004 | }; |
| 9005 | 9005 |
test/cases/compile_errors/untagged_union_integer_conversion.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | const UntaggedUnion = union {}; | ||
| 2 | comptime { | ||
| 3 | @intFromEnum(@as(UntaggedUnion, undefined)); | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :3:18: error: untagged union 'tmp.UntaggedUnion' cannot be converted to integer | ||
| 11 | // :1:23: note: union declared here | ||