Do @property attributes not allow postincrement operators?

import std.stdio;

struct Foo {
    @property bar() { return 10; }
    @property bar(int x) { writeln(x); }
}

void main()
{
    Foo foo;
    writeln(foo.bar); // actually calls foo.bar();
    foo.bar = 10; // calls foo.bar(10);

    // following doesn't work
foo.bar++; // would expect this to call foo.bar(foo.bar() + 1);
    // have to use:
    foo.bar = foo.bar + 1;
    writeln(foo.bar);
}

Reply via email to