D-Programming-Language/dmd — pull request #998 by donc (2012-06-11 11:14:07+00:00)
Title: Fix issue 8216 CTFE should allow 'pointer is inside range' comparisons

Allows comparisons between pointers to unrelated memory blocks as long as both directions are checked within a single && or || expression. This is a quite generous rule -- it gives at least 128 supported permutations of writing an 'is inside range' expression, and additionally there are absolutely no restrictions on the form of the four pointer expressions -- syntactically, the four pointer expressions need not have any relationship to one another.

Never allows the ordering to be exposed to user code. (In fact, internally there isn't any ordering!) So there is never any undefined or implementation-specific behaviour.

If an unsupported pointer comparison is executed, the error message gives an example of how to rewrite it into an acceptable form.

This commit also fixes a bug in the way null pointers are ordered (previously null > null returned true).