<div class="gmail_quote">On Tue, Aug 31, 2010 at 17:05, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 8/31/10 7:49 CDT, Michel Fortin wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On 2010-08-31 06:16:17 -0400, bearophile <<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>> said:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
If in generic code T.init is not guaranteed to be an lvalue, as your<br>
example shows, isn't it better to disallow (turning it into a syntax<br>
error) &T.init in all cases?<br>
</blockquote>
<br>
Personally, I'd say the code should check if T.init is an lvalue using<br>
__traits(compiles, &T.init) or is(typeof(&T.init)) and avoid creating a<br>
static variable or temporary when it is. This optimization of course<br>
depends &T.init not being a syntax error.<br>
</blockquote>
<br></div>
I recall I wrote that code to avoid a compiler bug when T == Tuple!(some types).<br><font color="#888888">
<br>
Andrei<br></font></blockquote><div><br>Is that related to this bug?<br><a href="http://d.puremagic.com/issues/show_bug.cgi?id=4536">http://d.puremagic.com/issues/show_bug.cgi?id=4536</a><br><br><br>Philippe<br> <br></div>
</div><br>