https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96435
Bug ID: 96435 Summary: d: Returning boolean in a union violates @safe code Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- In this test, the return value is both true and false at the same time. --- bool schrodingersCat() @safe { union Box { bool b; int state; } Box u; u.state = 42; return u.b; } void main() @safe { import std.stdio; bool b = schrodingersCat(); if (b) writeln("alive"); if (!b) writeln("dead"); }