[Issue 23497] Erroneous escape reference to parameter error.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 20 11:25:21 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23497

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

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

--- Comment #1 from RazvanN <razvan.nitu1305 at 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.

--


More information about the Digitalmars-d-bugs mailing list