Thread overview
[Issue 23497] Erroneous escape reference to parameter error.
Nov 20
RazvanN
Nov 20
deadalnix
4 days ago
mhh
4 days ago
mhh
1 day ago
deadalnix
1 day ago
mhh
November 20
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
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.

--
4 days ago
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.

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

mhh <maxhaton@gmail.com> changed:

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

--
1 day ago
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?

--
1 day ago
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.

--