On Saturday, 13 October 2012 at 09:06:28 UTC, Jakob Ovrum wrote:
Do note that this says *method* call. Your example doesn't use methods. Hence, the current state of operator overloading is consistent with TDPL.

I don't agree with the last sentence. According to TDPL:

1) "whenever at least one participant in an operator expression
is of user-defined type, the compiler rewrites the expression
into a regular method call with a specific name"
---------------------------------------------------------------
++var;
gets rewritten to:
var.opUnary!"++"();

2) "if a.fun(b, c, d) is seen but fun is not a member of a’s
type, D rewrites that as fun(a, b, c, d) and tries that as well"
----------------------------------------------------------------
So, because opUnary is not a member of var, compiler should rewrite that as:
.opUnary!"++"(var);

Reply via email to