[Issue 14343] Postfix increment doesn't work on structs with immutable member
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Mar 26 02:07:22 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14343
--- Comment #1 from Nicolas Sicard <dransic at gmail.com> ---
The problem doesn't show with the old operator overloading methods:
struct S
{
int i;
immutable(Object) o;
void opAddAssign(int j) { i += j; }
S opPostInc() { ++i; return this; }
void opAssign(S other) {}
}
unittest
{
S s;
++s;
assert(s.i == 1);
s++;
assert(s.i == 2);
}
--
More information about the Digitalmars-d-bugs
mailing list