[Issue 23381] New: null/init are not accepted as initializers of a zero-sized static array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 30 13:23:45 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23381
Issue ID: 23381
Summary: null/init are not accepted as initializers of a
zero-sized static array
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: maxsamukha at gmail.com
int[0] a = []; // ok
int[0] a1 = null; // fail
int[0] a2 = (int[]).init; // fail
void main()
{
}
onlineapp.d(2): Error: cannot implicitly convert expression `null` of type
`typeof(null)` to `int[0]`
onlineapp.d(3): Error: cannot implicitly convert expression `null` of type
`int[]` to `int[0]`
Accepted in function scopes:
void main()
{
int[0] a1 = null; // ok
int[0] a2 = (int[]).init; // ok
}
--
More information about the Digitalmars-d-bugs
mailing list