diff options
| author | Robin Voetter <robin@voetter.nl> | 2021-12-17 19:01:25 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2021-12-21 01:41:50 +0100 |
| commit | 16bddecff99eafb6c60d2c7a406d92d9c2d3c35a (patch) | |
| tree | 4a739f58ecc86b932e2b89981b7c953985e6ff91 /src/Sema.zig | |
| parent | d5621504b0e2160fa44991fc4180165584d72819 (diff) | |
| download | zig-16bddecff99eafb6c60d2c7a406d92d9c2d3c35a.tar.gz zig-16bddecff99eafb6c60d2c7a406d92d9c2d3c35a.zip | |
stage2: allow @ptrToInt on anything that is a pointer at runtime
This in particular allows @ptrToInt on pointer-like optionals.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 174e038db4..a51e6ffbf3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -5381,7 +5381,7 @@ fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const inst_data = sema.code.instructions.items(.data)[inst].un_node; const ptr = sema.resolveInst(inst_data.operand); const ptr_ty = sema.typeOf(ptr); - if (ptr_ty.zigTypeTag() != .Pointer) { + if (!ptr_ty.isPtrAtRuntime()) { const ptr_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty}); } |
