www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14343] New: Postfix increment doesn't work on structs with

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

          Issue ID: 14343
           Summary: Postfix increment doesn't work on structs with
                    immutable member
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: dransic gmail.com

struct S
{
    int i;
    immutable(Object) o;

    S opUnary(string op)() { return this; }
    void opAssign(S other) {}
}

void main()
{
    S s, t;

    t = s; // OK
    ++s; // OK
    s++; // Error: cannot modify struct s S with immutable members
}

--
Mar 26 2015