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: [email protected]
          Reporter: [email protected]

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`
```

--

Reply via email to