www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12663] New: Wrong error message for mutation of immutable


          Issue ID: 12663
           Summary: Wrong error message for mutation of immutable static
           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

immutable static int[] data = [1];
static this() {
void main() {}

DMD 2.066alpha gives an error message that is both wrong in contents and refers
to the wrong line:

test2.d(1,31): Error: constant 1u is not an lvalue

Expected is an error message like:

test2.d(3,5): Error: cannot modify immutable expression data

Apr 27 2014