[Issue 12709] New: unions and static-arrays not fully initialised

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 6 00:51:03 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12709

          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 at puremagic.com
          Reporter: anoneuron at 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.

--


More information about the Digitalmars-d-bugs mailing list