www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23367] New: can't `new` an empty array of bottom values

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

          Issue ID: 23367
           Summary: can't `new` an empty array of bottom values
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Ajieskola gmail.com

Compiled with a recent master DMD version, flags -preview=dip1000 -run

-----------------------------
 safe void main()
{ new noreturn[](0);
}
-----------------------------

This program crashes at runtime.

It should either compile and run succesfully, or fail compilation with
"statement has no effect" error. Reason for that is because no bottom values
are instantiated - the program is instantiating only an empty array.

--
Sep 24 2022