Thread overview
[Issue 20156] [REG2.080] Wrong error about local variable escape
Aug 23, 2019
anonymous4
Aug 23, 2019
anonymous4
Sep 21, 2019
Mike Franklin
Sep 21, 2019
Mike Franklin
Sep 21, 2019
Mike Franklin
Mar 24, 2022
RazvanN
Mar 24, 2022
Dennis
August 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20156

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Wrong error about local     |[REG2.080] Wrong error
                   |variable escape             |about local variable escape

--
August 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20156

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression

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

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #1 from Mike Franklin <slavo5150@yahoo.com> ---
This appears to be the same as Issue 17927 and Issue 20149

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

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=17927

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

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=20149

--
March 24, 2022
https://issues.dlang.org/show_bug.cgi?id=20156

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
I cannot reproduce this with the most recent master. Please reopen if you are able to reproduce.

--
March 24, 2022
https://issues.dlang.org/show_bug.cgi?id=20156

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #3 from Dennis <dkorpel@live.nl> ---
This is 'fixed' because `inout` doesn't imply `return` anymore (issue 22027).

If you change the function signature to this:
```
inout(int[]) f1(return ref inout A);
```
The error is back when you pass -preview=dip1000, but it's valid, because the
return value can be a pointer to the struct A which is allocated on the stack
in f2, and you can't store a stack pointer in a dynamic array.

If f1 becomes this (which is likely what the function should be, judging by the
types):
```
inout(int[]) f1(ref return scope inout A);
```
Then there's no error, which is correct because local var c is not `scope`.
Either way, it's fixed now.

--