In the following example, ++x calls opUnary while x++ is performed on x directly: struct X { int x; alias x this; typeof(this) opUnary (string operator) () { writeln ("operator called"); return this; } } unittest { X x; ++x; //operator called auto y = x++; //BUG! (alias this used. returns int) }
https://github.com/D-Programming-Language/dmd/pull/314
https://github.com/D-Programming-Language/dmd/commit/09998d8759d698ec25f9895734e64734a7f78a30