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

          Issue ID: 22922
           Summary: Support empty array literal in -betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

There is an unnecessary error for empty array literals when -betterC is
enabled.

```
extern(C) void main() {
        int[] x = [];
        int[] y = (cast(int*) null)[0 .. 0];
}
```

Compile with `dmd a.d -betterC` and it outputs:
```
a.d(2): Error: `TypeInfo` cannot be used with -betterC
```

Since the expression `(cast(int*) null)[0 .. 0]` works, DMD should be able to
translate `[]` into it without needing TypeInfo.

--

Reply via email to