Thread overview
[Issue 23657] [REG2.101] Incorrect error escape reference to stack allocated value
Jan 27, 2023
Dennis
Apr 23
Dennis
Apr 23
Dennis
6 days ago
Dlang Bot
4 days ago
Dlang Bot
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 ***

--
April 23
https://issues.dlang.org/show_bug.cgi?id=23657

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |---

--- Comment #2 from Dennis <dkorpel@live.nl> ---
Reopened because this issue is not limited to std.array, and is more about general return scope inference triggering errors in @system non-dip1000 code, like Johan mentions in issue 23300:

> Note that this bug does not require DIP1000, and breaks compilation since 2.101.

--
April 23
https://issues.dlang.org/show_bug.cgi?id=23657

--- Comment #3 from Dennis <dkorpel@live.nl> ---
https://github.com/dlang/dmd/pull/16407

--
6 days ago
https://issues.dlang.org/show_bug.cgi?id=23657

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #16407 "Fix bugzilla 23657 - [REG2.101] Incorrect error escape reference to s…" was merged into stable:

- 81f9dd203c45a4cfb1d68efed70621c150100c21 by Dennis Korpel:
  Fix bugzilla 23657 - [REG2.101] Incorrect error escape reference to stack
allocated value

https://github.com/dlang/dmd/pull/16407

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=23657

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #16409 "merge stable" was merged into master:

- 1da572ac2e40cda8be7b1012fe8e7aebff0d511d by Dennis:
  Fix bugzilla 23657 - [REG2.101] Incorrect error escape reference to stack
allocated value (#16407)

  Co-authored-by: Dennis Korpel <dennis@sarc.nl>

https://github.com/dlang/dmd/pull/16409

--