[Issue 23657] [REG2.101] Incorrect error escape reference to stack allocated value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 27 13:36:14 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23657
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |dkorpel at live.nl
Resolution|--- |DUPLICATE
--- Comment #1 from Dennis <dkorpel at 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 ***
--
More information about the Digitalmars-d-bugs
mailing list