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

dangbinghoo dangbinghoo at gmail.com
Mon Oct 22 01:39:48 UTC 2018


On Friday, 19 October 2018 at 09:08:32 UTC, Vijay Nayar wrote:
> Technically the code you have is syntactically correct.  You 
> are permitted to create a class variable without assigning it 
> to a class object.  (Assigning it to a class object would look 
> like "A a = new A();")
>
> Which section of The D Programming Language book makes you 
> think this would not compile?  I have the book as well, but I'm 
> not quite sure what part of the book you're referring to.

the section 6.2, which is
---
A a;
a.x = 5;
---

the book explained this should be refused to compile.


thanks!

--
dangbinghoo


More information about the Digitalmars-d-learn mailing list