static assert(null is null); --- bug.d(1): Error: static assert (null is null) is not evaluatable at compile t ime Whereas the code below compiles fine: int main(){ return (null is null); } --- This also applies to similar kinds of expressions, eg (null is typeid(int)). The patch for this relies on my patch for 1524, otherwise you get an ICE with "null is typeid(int)".
PATCH in optimize.c, line 779, in IdentityExp::optimize(int result) Just allow TOKnull as one of the parameters. OLD: if (this->e1->isConst() && this->e2->isConst()) { e = Identity(op, type, this->e1, this->e2); } NEW: if ((this->e1->isConst() || this->e1->op == TOKnull) && (this->e2->isConst()|| this->e2->op == TOKnull)) { e = Identity(op, type, this->e1, this->e2); }
Does things break if NullExp::isConst() was just implemented? After all, null is constant...
Fixed dmd 1.047 and 2.032