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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 31 22:41:48 UTC 2019


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #13 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Manu from comment #10)
> (In reply to Dennis from comment #7)
> > (In reply to Manu from comment #6)
> > > Accessing uninitialised memory is absolutely a memory safety issue. 
> > 
> > Not per se. This compiles, prints a random number, and doesn't corrupt
> > memory.
> > 
> > ```
> > import std;
> > 
> > void main() @safe
> > {
> >     int a = void;
> >     writeln(a);
> > }
> > ```
> 
> Hah, well that's obviously broken too!

For reference, that's issue 18016. Walter has an open PR to resolve it by
making the value of `a` "implementation defined".

--


More information about the Digitalmars-d-bugs mailing list