August 11, 2021
https://issues.dlang.org/show_bug.cgi?id=22200

          Issue ID: 22200
           Summary: it is not specified that `$` yield a rvalue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: b2.temp@gmx.com

I was curious to see if the following

```
void main()
{
    int[] a;
    a[++$ - 1] = 0;
}
```

worked. It is not

> /tmp/temp_7F0644F44CF0.d:8:9: Error: cannot modify operator `$`

but given the specifications

> the spec is "Within the [ ] of a static or a dynamic array, the symbol $ represents the length of the array."

it was not clear that this will fail.

--