Thread overview
[Issue 23657] [REG2.101] Incorrect error escape reference to stack allocated value
Jan 27, 2023
Dennis
January 26, 2023
https://issues.dlang.org/show_bug.cgi?id=23657

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry

--
January 26, 2023
https://issues.dlang.org/show_bug.cgi?id=23657

johanengelen@weka.io changed:

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

--
January 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23657

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dkorpel@live.nl
         Resolution|---                         |DUPLICATE

--- Comment #1 from Dennis <dkorpel@live.nl> ---
Reduced:
```
import std.algorithm: map;
import std.array: array;

struct SmallSet
{
    ushort[13] keys;
    auto items() return { return keys[]; }
}

public struct RA {
    SmallSet members() { return SmallSet(); }
}

RA agent;

auto foo() {
    return agent.members.items.map!(x => x).array;
}
```

The problem is that members.items returns a slice to a local variable, which should be okay because you call `array` in the end, but there you hit Issue 23300.

*** This issue has been marked as a duplicate of issue 23300 ***

--