D-Programming-Language/dmd — pull request #1019 by 9rnsr (2012-06-20 01:59:16+00:00)
Title: Implement `auto ref` that can receive both lvalue and rvalue, even if the function is template or not.

For rvalue argument, compiler will assign it to a temporary variable, and get its reference.
Change ref parameter semantics that can receive only pure lvalues, so users cannot pass struct-literals and constructions with `ref`.
Then opEquals in struct should have the signature:
`bool opEquals(const auto ref typeof(this) rhs) const;`
instead of:
`bool opEquals(const ref typeof(this) rhs) const;`

Note:
The current mangling character for `auto ref` is same as for `ref`, it is 'K'.
So overloading of `auto ref` and `ref` function is disallowed by the linker.