September 05, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@JinShil created dlang/dmd pull request #10390 "Fix Issue 20149 - [DIP1000] Local data escapes `inout opSlice` if not annotated with `return`" fixing this issue:

- Fix Issue 20149 - [DIP1000] Local data escapes `inout opSlice` if not annotated with `return`

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

--
September 05, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@JinShil created dlang/druntime pull request #2785 "Add `return` to `DSO.moduleGroup()` in support of compiler fix for issue 20149" mentioning this issue:

- Add `return` to `DSO.moduleGroup()` in support of compiler fix for issue
20149

https://github.com/dlang/druntime/pull/2785

--
September 05, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #2785 "Add `return` to `DSO.moduleGroup()` in support of compiler fix for issue 20149" was merged into stable:

- 4f1568cf77085dd3ca9c5e0468c22382fcc28a0d by Mike:
  Add `return` to `DSO.moduleGroup()` in support of compiler fix for issue
20149

https://github.com/dlang/druntime/pull/2785

--
September 07, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #9 from Walter Bright <bugzilla@digitalmars.com> ---
Not sure yet where the error is, but it isn't with the `inout`.

--
September 08, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #10 from Walter Bright <bugzilla@digitalmars.com> ---
Here's what's actually happening. It has nothing to do with inout. A reduced example:
-----------------
@safe:

struct S {
  this(int) { }
  char[] opSlice() return { return buf[]; }
  char[4] buf;
}

S bar();

char[] fun() {
  return S()[]; // Error: escaping ref to stack value returned by S('\xff')
  return S(1)[]; // should generate same error here
  return bar()[]; // Error: escaping ref to stack value returned by bar()
}
----------------

The trouble is that the temporary returned by the constructor call is being treated differently than the temporary returned by the struct literal and the temporary returned by the function call, when they should be treated the same.

--
September 08, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[DIP1000] Local data        |[DIP1000] temp returned
                   |escapes `opSlice` if not    |from constructor call not
                   |annotated with `return`     |checked for scope problems

--
September 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #11 from Dlang Bot <dlang-bot@dlang.rocks> ---
@JinShil created dlang/dmd pull request #10402 "Issue 20149 - [DIP1000] temp returned from constructor call not checked for scope problems" mentioning this issue:

- Issue 20149 - [DIP1000] temp returned from constructor call not checked for scope problems

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

--
September 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #12 from Mike Franklin <slavo5150@yahoo.com> ---
(In reply to Walter Bright from comment #10)
> A reduced example:

https://github.com/dlang/dmd/pull/10402 should fix that issue, but unfortunately, it doesn't fix the original issue.

--
September 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

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

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

--- Comment #13 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10402 "Fix Issue 20149 - [DIP1000] temp returned from constructor call not checked for scope problems" was merged into stable:

- c2ef8221d980d6c5957a77eae1ace8a17b3d3242 by Mike:
  Fix Issue 20149 - [DIP1000] temp returned from constructor call not checked
for scope problems

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

--
September 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20149

Mike Franklin <slavo5150@yahoo.com> changed:

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

--- Comment #14 from Mike Franklin <slavo5150@yahoo.com> ---
Reopening. The original issue still remains.

--