On Tuesday, 1 January 2013 at 17:52:20 UTC, bearophile wrote:
A small quiz (it's a reprise of an older discussion). This code compiles with no errors, but do you see anything wrong here?
Well I see that you have opIndexUnary twice; According to the manual you wouldn't need as it would rewrite the code so you only need it once; Also they return void when they should return the value of x before/after the change.
Also although the alias this makes the number increment, it should be specifying 'x', not that it seems to make a difference.
Do you think this code should produce some compilation errors?
As it is I don't see any problems...