zygoloid wrote:
Perhaps we can start by supplying `CheckForModifiableLvalue` with extra
information about *why* we're doing the check. The current diagnostic we get
for incrementing a non-modifiable lvalue:
```console
<source>:2:3: error: cannot assign to variable 'n' with const-qualified type
'const int'
2 | ++n;
| ^ ~
```
... is really bad -- this isn't an assignment, it's an increment. An enum of
possible reasons why we're doing the check would let us significantly improve
the diagnostic here.
https://github.com/llvm/llvm-project/pull/94159
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits