http://wiki.dlang.org/DIP25 has been preliminarily approved for 2.067

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 16 15:24:23 PST 2015


On 1/16/2015 2:13 PM, Steven Schveighoffer wrote:
> I can potentially see a situation like this:
>
> auto fun(T)(return ref T x)
>
> Where the auto deduces to something that couldn't possibly match T or any piece
> of it. Causing this function to error just because of a type mismatch is the
> wrong move.

That is addressed by the DIP, it is specifically allowed that a 'return ref' can 
be used even when the pointer cannot be coerced into the returned ref.

This is so that the 'return ref' can refer to a container that completely owns 
its contents, and this ownership can thus be transferred to the output.



More information about the Digitalmars-d mailing list