Thread overview
[Issue 23497] Erroneous escape reference to parameter error.
Nov 20, 2022
RazvanN
Nov 20, 2022
deadalnix
Nov 23, 2022
mhh
Nov 24, 2022
mhh
Nov 27, 2022
deadalnix
Nov 27, 2022
mhh
Dec 08, 2022
Dlang Bot
Dec 12, 2022
Dlang Bot
Dec 12, 2022
Dlang Bot
Dec 15, 2022
Dlang Bot
November 20, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
I guess the error may make sense. `t` is a struct and is going to get destroyed when `errorize` finishes execution. Since `t._error` is a reference type, a reference to `_error` is going to be escaped and then `t` is going to get destroyed and you end up with a reference to some destructed data. I am not advocating that the error should be issued, just saying that it could make sense.

What is puzzling is that if you return `t._error` or if you comment the call to `kind()` in the in contract then the error goes away. Also, there is no -dip1000 or @safe involved so I don't know why the compiler is such a nagger.

--
November 20, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

--- Comment #2 from deadalnix <deadalnix@gmail.com> ---
No, it's nonsense, and no reference to _error is going to escape. _error is a pointer, and it is returned by value. What escapes is a reference to the class instance _error points toward.

Also, the in contract is somehow needed for the error to trigger, so something's not right either way.

--
November 23, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #3 from mhh <maxhaton@gmail.com> ---
The `in` contract "causes" this to trigger because `kind` is neither explicitly declared nor inferred to be scope.

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

mhh <maxhaton@gmail.com> changed:

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

--
November 27, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

--- Comment #4 from deadalnix <deadalnix@gmail.com> ---
There is nothing broken in that code and it used to work. So this is the end of this?

That is some more DIP1000 related nonsense, isn't it?

--
November 27, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

--- Comment #5 from mhh <maxhaton@gmail.com> ---
Yeah (I forgot to add more detail), it's broken. Something in the in block seems to make it think it should be noisy. Very hard to bisect because of the druntime merge.

--
December 08, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

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

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@deadalnix created dlang/dmd pull request #14677 "Fix 23497" fixing this issue:

- Fix 23497

  This is achieved by reverting 4e7c4925772fe6e098d3a0736f25cb4fae4bce0b,
  which introduced the regression, and adding a new test case that ensure
  this specific regression doesn't happen again going forward.

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

--
December 12, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@dkorpel created dlang/dmd pull request #14686 "Fix 23497 - Erroneous escape reference to parameter error" fixing this issue:

- Fix 23497 - Erroneous escape reference to parameter error

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

--
December 12, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

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

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

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14686 "Fix 23497 - Erroneous escape reference to parameter error" was merged into stable:

- 49a90204bc4859b8dc5515c681f47023f34c3436 by Dennis Korpel:
  Fix 23497 - Erroneous escape reference to parameter error

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

--
December 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23497

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

- 52c5e2fbd41f7e8ae0a45be75ac74f9f6f5c6351 by Dennis Korpel:
  Fix 23497 - Erroneous escape reference to parameter error

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

--