[Issue 18088] wrong lifetime evaluation of pointers or this-pointers in a struct with @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 16 19:04:37 UTC 2017


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

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
i'd say that dmd is absolutely right here. remember that struct can be *moved*
by the compiler at any time, and stored `&aVar` will point to random memory
after that.

so while compiler is correctly forbidding that construct in @safe code, the
error message is really misleading, and doesn't help at all. i think that it's
better to fix bug description to something like "misleading error message", or
alike.

--


More information about the Digitalmars-d-bugs mailing list