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

Carsten Blüggel <chi...@posteo.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid, spec

--- Comment #1 from Carsten Blüggel <chi...@posteo.net> ---
Another error example from phobos that appeared in master within the last ~24h:
https://github.com/dlang/phobos/blob/master/std/exception.d

make -f posix.mak std/exception.test (-dip1000 for that module; DMD64 master)

std/exception.d(1243): Error: returning & i escapes a reference to local
variable i

excerpt from std/exception.d:

/// Arrays (dynamic and static)
@system unittest
{
    int i;
    int[]  slice = [0, 1, 2, 3, 4];
    int[5] arr   = [0, 1, 2, 3, 4];
    int*[]  slicep = [&i];               <= line 1243
    int*[1] arrp   = [&i];
...
    assert( slicep[0].doesPointTo(i));   <= slicep usage
    assert(!slicep   .doesPointTo(i));   <= slicep usage
...

1. This is @system code, allowed to escape whatever
2. There is no escape (commenting out slicep usages doesn't change error
reported)

--

Reply via email to