Discussion Thread: DIP 1035-- at system Variables--Community Review Round 2

Paul Backus snarwin at gmail.com
Sat Feb 27 20:07:30 UTC 2021


On Saturday, 27 February 2021 at 19:05:01 UTC, Steven 
Schveighoffer wrote:
>
> D considers that @safe. It was a whole section of my Dconf 
> online talk. I filed a bug report on it (in which you seem to 
> think this is OK): 
> https://issues.dlang.org/show_bug.cgi?id=21565
>
> Even without templates:
>
> struct DThinksThisIsSafe
> {
>    union Storage { int value; void *dummy; }
>    Storage storage;
>    @safe ref int get() return { return storage.value; } // 
> compiles just fine
> }

Ah, right, because you're only accessing the int, not the 
pointer. Good catch.


More information about the Digitalmars-d mailing list