[Issue 17117] auto ref "escaping reference to local variable"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 24 02:13:46 PST 2017


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

John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin at gmail.
                   |                            |com
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|enhancement                 |regression

--- Comment #1 from John Colvin <john.loughran.colvin at gmail.com> ---
I suspect this is the same bug, seeing it's the same error in similar
circumstances regressed across the same release.

This worked fine in 2.072.2 and now fails in 2.073:

ref int foo(return ref int s)
{
    return s;
}

int fail()
{
    int s;
    return foo(s); // Error: escaping reference to local variable s
}

int ok()
{
    int s;
    s = foo(s);
    return s;
}


Changed to regression because it's broken correct code.

--


More information about the Digitalmars-d-bugs mailing list