[Issue 20547] New: Wrong error message when trying to "new" an associative array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 30 21:32:45 UTC 2020


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

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

--


More information about the Digitalmars-d-bugs mailing list