www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22487] New: Array!T.init.data crashes


          Issue ID: 22487
           Summary: Array!T.init.data crashes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch
                CC: dandrei279 gmail.com, maxhaton gmail.com

The fix for issue 21100 is buggy, the following code crashes:

void main(){
    import std.container;
    Array!int a;
core.exception.AssertError std/typecons.d(6644): Attempted to access an
uninitialized payload.

It should check whether the data is initialized, like most other members of
Array!T do. If the data is not initialized, it should return an empty dynamic

Nov 07 2021