Hi,<div><br></div><div>I'm new to D and trying to follow Alexandrescu's TDPL code examples I came across an error on the code below:</div><div><br></div><div><div>class A</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>inout(int) val() inout</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return _val; // error - see below</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>private int _val;</div><div>};</div></div><div><br></div><div>The compiler (dmd v2.052) complains on the marked line with the message "Error: inout on return means inout must be on a parameter as well for inout inout(int)()". </div>
<div><br></div><div>What am I doing wrong? TDPL has a very similar example...</div><div><br></div><div>Regards,</div><div>Claudiu</div><div><br></div><div>P.S. Is there a netiquette (a la C++ FAQ lite) about posting on this forum that I should be aware of?</div>
<div><br></div>