digitalmars.D.bugs - [Issue 21450] New: slice operator is not required for assignment to
- d-bugmail puremagic.com (27/27) Dec 03 2020 https://issues.dlang.org/show_bug.cgi?id=21450
https://issues.dlang.org/show_bug.cgi?id=21450 Issue ID: 21450 Summary: slice operator is not required for assignment to all elements of static array Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: mrsmith33 yandex.ru When assigning to slice, slice operator is required. However when assigning to static array compiler silently allows it, which can lead to bugs. This behavior should be consistent between slices and static arrays. ``` ubyte[] slice; slice[] = 2; // ok slice = 2; // error as expected ubyte[2] array; array[] = 2; // ok array = 2; // doesn't error, works as `array[] = 2` ``` --
Dec 03 2020