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

anonymous4 <dfj1es...@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 OS|Linux                       |All

--- Comment #2 from anonymous4 <dfj1es...@sneakemail.com> ---
Safe D and DIP1000 were created for this.

int[] makeRef(return int[] a)
{
    return a;
}

int[] getArray()
{
    int[10] a;
    a []= 42;
    return makeRef(a);
}

void main()
{
    writefln("%s",getArray());
}

Error: returning makeRef(cast(int[])a) escapes a reference to local variable a

--

Reply via email to