www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12709] New: unions and static-arrays not fully initialised


          Issue ID: 12709
           Summary: unions and static-arrays not fully initialised
           Product: D
           Version: D2
          Hardware: x86
               URL: http://dpaste.dzfl.pl/fe1cf8759bb7
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: anoneuron gmail.com

Created attachment 1355
  --> https://issues.dlang.org/attachment.cgi?id=1355&action=edit
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.

May 06 2014