assigment to null class object member compiled? is this a bug?

Adam D. Ruppe destructionator at gmail.com
Mon Oct 22 16:18:09 UTC 2018


On Friday, 19 October 2018 at 06:53:32 UTC, dangbinghoo wrote:
> why the code bellow compiles?

D compilers are allowed to make that an error, but it might not.

With the current implementation,

dmd that.d

will compile, but

dmd -O that.d

will fail with an error. Yes, turning on optimizations happens to 
catch the null flow at compile time.

It is just a matter of compiler implementation happening to catch 
it or not.


More information about the Digitalmars-d-learn mailing list