[Issue 14343] New: Postfix increment doesn't work on structs with immutable member

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Mar 26 02:05:25 PDT 2015


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 at puremagic.com
          Reporter: dransic at 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
}

--


More information about the Digitalmars-d-bugs mailing list