www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19272] New: scope class and const/immutable doesn't work

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

          Issue ID: 19272
           Summary: scope class and const/immutable doesn't work together
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

The following code fails to compile with DMD 2.082.0:

void main()
{
    scope a = new const Object; //  Error: cannot modify `const` expression `a`
    scope b = new immutable Object; // Error: cannot modify `immutable`
expression `b`
}

--
Sep 28 2018