Bug 12709 – unions and static-arrays not fully initialised

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-05-06T07:51:00Z
Last change time
2015-10-22T15:30:10Z
Assigned to
nobody
Creator
cauterite

Attachments

IDFilenameSummaryContent-TypeSize
1355unionbug.da copy of the test program, in case dpaste goes offlineapplication/octet-stream1500

Comments

Comment #0 by cauterite — 2014-05-06T07:51:03Z
Created attachment 1355 a copy of the test program, in case dpaste goes offline DMD 2.065 seems to be leaving static-arrays and (POD) unions only partially initialised in many cases. Here's a test program illustrating where the bug appears: http://dpaste.dzfl.pl/fe1cf8759bb7 This seems like a fairly substantial issue to me, as it violates an assumption one should be able to make about POD union literals: assert(UnionTypeA(b) is UnionTypeA(b)). Therefore, I've marked it as 'major', however I'm not very familiar with the severity scale for D bugs, so I apologise if that's not the appropriate label. I managed to find a pretty decent workaround using templates for the union-literal cases — I can share the details if anyone's interested.
Comment #1 by cauterite — 2015-10-22T15:30:10Z
I don't know when this was fixed, but in DMD v2.068.2 this bug is not present.