www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20422] New: confusing error "new can only create structs,

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

          Issue ID: 20422
           Summary: confusing error "new can only create structs, dynamic
                    arrays or class objects, not int[]'s"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

This code:
```
void main() {
    new int[];
}
```

Gives this error message:
"new can only create structs, dynamic arrays or class objects, not int[]'s

int[] is obviously a dynamic array, the real problem is that no length
parameter is given.

--
Nov 29 2019