digitalmars.D.bugs - [Issue 24477] New: Union access of bool shouldn't be allowed in safe
- d-bugmail puremagic.com (30/30) Apr 01 https://issues.dlang.org/show_bug.cgi?id=24477
https://issues.dlang.org/show_bug.cgi?id=24477 Issue ID: 24477 Summary: Union access of bool shouldn't be allowed in safe Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: safe Severity: normal Priority: P3 Component: dmd Assignee: nobody puremagic.com Reporter: dkorpel live.nl See https://issues.dlang.org/show_bug.cgi?id=20148#c8 ``` bool schrodingersCat() safe { union Box { bool b; ubyte y; } Box u; u.y = 2; return u.b; } void main() safe { import std.stdio; bool b = schrodingersCat(); if (b) writeln("alive"); if (!b) writeln("dead"); } ``` --
Apr 01