[Issue 20673] New: Improve error message for opDollar in pointers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 15 22:04:07 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20673
Issue ID: 20673
Summary: Improve error message for opDollar in pointers
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: pro.mathias.lang at gmail.com
A very common beginner mistake:
```
void main ()
{
int* ptr;
assert(ptr[0 .. $] == [1, 2, 3]);
}
```
This will yield the following message:
```
diagxxx.d(4): Error: undefined identifier __dollar
```
Not quite as informative as it could be. This could be a good starting task for
someone wanting to touch DMD. The error is produced here:
https://github.com/dlang/dmd/blob/631473e8746050bd743fe238ba343c079e0f25e0/src/dmd/expressionsem.d#L2721
--
More information about the Digitalmars-d-bugs
mailing list