In the following four cases of "if" I think it's better to receive warnings from the compiler, because the code probably contains mistakes (this compiles with no errors on DMD 2.053): struct Foo { int x; bool foo() { return true; } } void main() { Foo* p; int* arr = (new int[5]).ptr; if (p != null || p.x) {} if (p == null && p.foo()) {} if (!p && p.foo()) {} if (arr == null && arr[3]) {} }
This is more suited for a third party library. Also, the compiler will need to do dataflow analysis to understand these cases.