From e2a294504e39c50483caf4552803f113dd5da23d Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:14:46 +0800 Subject: [PATCH] fixes #25066; forbids comparing pointers at compile time (#25103) fixes #25066 Probably it is not worth implementing comparing pointers at compile time. For a starter, we can improve the error message instead of letting it crash --- compiler/vmgen.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index e365d3f236..ae60851c5f 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1182,8 +1182,10 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}, m: TMag of mEqF64: genBinaryABC(c, n, dest, opcEqFloat) of mLeF64: genBinaryABC(c, n, dest, opcLeFloat) of mLtF64: genBinaryABC(c, n, dest, opcLtFloat) - of mLePtr, mLeU: genBinaryABC(c, n, dest, opcLeu) - of mLtPtr, mLtU: genBinaryABC(c, n, dest, opcLtu) + of mLeU: genBinaryABC(c, n, dest, opcLeu) + of mLtU: genBinaryABC(c, n, dest, opcLtu) + of mLePtr, mLtPtr: + globalError(c.config, n.info, "pointer comparisons are not available at compile-time") of mEqProc, mEqRef: genBinaryABC(c, n, dest, opcEqRef) of mXor: genBinaryABC(c, n, dest, opcXor)