www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20673] New: Improve error message for opDollar in pointers


          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 puremagic.com
          Reporter: pro.mathias.lang 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:

Mar 15 2020