On Tuesday, 24 January 2017 at 00:52:34 UTC, Robert burner Schadek wrote:
I have this program that used to compile with 72 but with 73 dmd is complaining that
"Error: escaping reference to local variable t"

auto ref f2(T)(auto ref T t, auto ref T s) {
        return t;
}

auto ref f1(T)(auto ref T t, auto ref T s) {
        return f2(t, s);
}

unittest {
        int a = f1(1,2);
}

I'm not sure why, or how to fix that.

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

Seems to work as expected.
The literals 1,2 cannot be ref.
Therefore it's a normal parameter.
A function parameter is the same as a local
hence retuning a ref to it will cause this to happen.

Reply via email to