On Wednesday, 9 January 2013 at 04:33:21 UTC, Zach the Mystic wrote:
I felt confident enough about my proposal to submit it as enhancement request:

http://d.puremagic.com/issues/show_bug.cgi?id=9283

I like it. One issue though, like you also indicated by putting question marks on it:

ref T get(T)()
{
  T local;
  return cast(out) local; // This shouldn't compile
}

Because, wouldn't returning a local variable as a reference be a dangling reference in all cases? No matter if the programmer claims it's correct by saying cast(out)... it just can't be correct.

And T can be a type that has reference semantics or value semantics, it doesn't matter. That function would always return a dangling reference, were it allowed to compile.

Reply via email to