http://d.puremagic.com/issues/show_bug.cgi?id=8902
monarchdo...@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdo...@gmail.com Severity|normal |major --- Comment #1 from monarchdo...@gmail.com 2012-10-28 01:06:44 PDT --- (In reply to comment #0) > Should assigning `.init` to a union be allowed or disallowed? At leas current > behavior is inconsistent: > > --- > union U { int a, b; } > > enum U u0 = U.init; // No errors > U u1; // No errors > U u2 = U.init; // Error: duplicate union initialization for b > > void main() > { > U u3 = U.init; // No errors > immutable U u4 = U.init; // No errors > immutable static U u5 = U.init; // Error: duplicate union... > static U u6 = u4; // Error: duplicate union... > static U u7 = U.init; // Error: duplicate union... > } > --- It would further more appear that the compiler has trouble detecting this in conditional implementations, which makes it difficult to bypass this problem. //---- import std.stdio; union U { int a, b; } void main() { static if (is(typeof((inout int _dummy=0){static U i = U.init;}))) //FINE { static U i = U.init; //L9: DERP } } //---- main.d(9): Error: duplicate union initialization for b //---- Raising priority due to the impossibility to easily bypass this problem... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------