www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - TDPL book and __traits(compiles...) snippet

In section 6.2 of The D Programming Language it talks about how 
the compiler will try and tell if you are going to use a null 
reference. It gives this code snippet below to demonstrate that. 
But with DMD v2.096.1-dirty I am getting that the compiler thinks 
the code is OK. With a "!" the assert fails.

class A { int x; }
A a;
assert(!__traits(compiles, a.x = 5));
Jul 10 2021