Bug 4099 – Inconsistent behaviour of ++/-- when mixing opUnary and 'alias this'.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-17T05:13:00Z
Last change time
2011-08-25T00:23:10Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
a3471210

Comments

Comment #0 by a3471210 — 2010-04-17T05:13:08Z
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) }
Comment #1 by k.hara.pg — 2011-08-15T20:38:36Z
Comment #2 by bugzilla — 2011-08-25T00:23:10Z