Bug 20673 – Improve error message for opDollar in pointers

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-15T22:04:07Z
Last change time
2024-12-13T19:07:41Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Mathias LANG
Moved to GitHub: dmd#17946 →

Comments

Comment #0 by pro.mathias.lang — 2020-03-15T22:04:07Z
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
Comment #1 by nick — 2023-09-11T10:48:29Z
Recent dmd does at least use `$`: slice.d(20): Error: undefined identifier `$`
Comment #2 by robert.schadek — 2024-12-13T19:07:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17946 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB