[Issue 20084] return by auto ref unsafe - and different code for inout ref and ref.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 25 22:08:27 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20084

--- Comment #2 from Ali Ak <ali.akhtarzada at gmail.com> ---
(In reply to Ali Ak from comment #0)
> But why does ref T return by ref? 

*by value

> auto ref get(Range)(Range range) {
>     return range.front;
> }

I meant:

auto ref get(Range)(auto ref Range range) {
    return range.front;
}

--


More information about the Digitalmars-d-bugs mailing list