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

(cherry picked from commit e2a294504e)
This commit is contained in:
ringabout
2025-08-27 16:14:46 +08:00
committed by narimiran
parent c339651ae1
commit 1735e585f2

View File

@@ -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)