www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12682] New: Bad error messages with global assignment of

https://issues.dlang.org/show_bug.cgi?id=12682

          Issue ID: 12682
           Summary: Bad error messages with global assignment of mutable
                    lambda value
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

int function(int) f2;
auto f1 = (int x) => x; // OK
     f2 = (int x) => x; // Errors
void main() {
    f2 = (int x) => x;  // OK
}


DMD 2.066alpha gives:

test.d(3,9): Error: no identifier for declarator f2
test.d(3,9): Error: Declaration expected, not '='


Here I'd like D to give a single better error message, that explains the true
problem.

--
Apr 30 2014