The liabilities of binding rvalues to ref

Timon Gehr timon.gehr at gmx.ch
Sun May 5 05:16:41 PDT 2013


On 05/05/2013 02:11 PM, Peter Alexander wrote:
> On Sunday, 5 May 2013 at 11:55:28 UTC, Timon Gehr wrote:
>> I still think auto ref should be extended to work for non-templated
>> functions. The semantics should be the same (i.e. behave as if there
>> were two copies that are eagerly semantically analyzed, but only
>> generate code for one) where possible.
>
> This is not the case currently for template auto ref functions. For
> example, the two "versions" of the auto ref function do not share local
> static variables, nor do they have the same function address.

Very good point about the local static variables. This would be a wart 
of my proposed solution, as they'd need to be banned for auto ref functions.

> They are literally two (or four, or eight, ...) separate functions. I really
> dislike how they have been implemented.
>

Me too, but it makes sense to have two functions in some cases.


More information about the Digitalmars-d mailing list