<div dir="ltr"><div>In future release, non-static const or immutable field will be made an instance field.</div><div><br></div><div>struct S</div><div>{</div><div> immutable int x = 1;</div><div>}</div><div>static assert(S.sizeof == int.sizeof); // will succeed in the future</div>
<div><br></div><div>So current "implicit static" behavior is now deprecated.</div><div><br></div><div>Related:</div><div><a href="http://dlang.org/changelog#staticfields">http://dlang.org/changelog#staticfields</a><br>
</div><div><a href="http://dlang.org/changelog#staticfields2">http://dlang.org/changelog#staticfields2</a><br></div><div><br></div><div>Kenji Hara</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-30 2:09 GMT+09:00 Andrei Alexandrescu via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A recent discussion <a href="https://github.com/D-Programming-Language/dmd/pull/3452" target="_blank">https://github.com/D-<u></u>Programming-Language/dmd/pull/<u></u>3452</a> brought up a matter I'd forgotten - struct fields that are immutable and have initializer are deprecated.<br>
<br>
Why?<span class="HOEnZb"><font color="#888888"><br>
<br>
Andrei<br>
</font></span></blockquote></div><br></div>