[Issue 15542] pure function with no argument returning different values (with void-initialized static array)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 27 12:18:43 UTC 2017


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

--- Comment #7 from ag0aep6g at gmail.com ---
(In reply to Steven Schveighoffer from comment #6)
> It's perfectly memory safe to look at/use
> your own stack frame without initialization, as long as data doesn't contain
> a reference.

It still has undefined behavior, and `@safe` is supposed to rule out undefined
behavior. So, according to the spec, `@safe` should prevent the code from
compiling.

This is all about `@safe` and has nothing to do with `pure`, though. I've filed
a new issue: issue 18016.

--


More information about the Digitalmars-d-bugs mailing list