[Issue 19916] union member access should be un- at safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 5 20:50:58 UTC 2019


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

--- Comment #21 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Manu from comment #20)
> T x = void; // <- DOES lead to memory corruption; it's effectively an
> explicit statement to do memory corruption. How could a more explicit
> violation of @safe exist, no matter how you squint and interpret it?
> 

I don't care strongly either way. You'll have to convince Walter.


[...]
> > You might want to argue your position in
> > <https://github.com/dlang/dlang.org/pull/2260>. It's an open PR by Walter
> > where he does exactly what you oppose here: he wants to explicitly allow
> > accessing uninitialized memory in @safe code (unless it involves pointers).
> 
> That PR doesn't appear to have anything to do with @safe?

But it clearly does. It resolves issue 18016 which is about accessing void
initialized memory in @safe code. With the PR, the spec will allow that. DMD
already allows it (in conflict with the current spec).

--


More information about the Digitalmars-d-bugs mailing list