www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20547] New: Wrong error message when trying to "new" an


          Issue ID: 20547
           Summary: Wrong error message when trying to "new" an
                    associative array
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

DMD yields poor error messages when trying to allocate a dynamic array:

void main()
    int[int] a = new int[int]; // need size of rightmost array, not type int
    int[string] b = new int[string]; // cannot pass type string as a function
    int[string] c = new typeof(b); // new can only create structs, dynamic
arrays or class objects, not int[string]'s

a and b should produce the same output as c.

Jan 30 2020