opCast doco is not very helpful: http://dlang.org/spec/operatoroverloading.html#cast
This says something about 'bool', but nothing about any other type.
When is the cast operator invoked? What circumstances will it be used?
Is opCast only explicit, or will it be used for implicit casts?
What happens if the src has an opCast, and the target type has a constructor that receives the src type? In that situation, when will the opCast be used, and when will the constructor be used?
Comment #1 by schveiguy — 2016-09-02T12:50:50Z
The table does say, cast(T)u is rewritten to u.opCast!(T)()
Probably could be spelled out better to indicate that's the ONLY case where opCast is used (aside from the boolean for if clauses)
Comment #2 by turkeyman — 2016-09-02T12:55:15Z
Wow, you're right.
I didn't make any sense of that table at all.
Compare that table to the table of binary operators immediately below.
That inconsistency possibly lead me to overlook that table as noise.
Anyway, I don't think it's well expressed when I couldn't see it right in front of my face! ;)
Comment #3 by schveiguy — 2016-09-02T13:27:21Z
(In reply to Manu from comment #2)
> Compare that table to the table of binary operators immediately below.
Compare that to the table of slice operators above :)
I think actually, the table is a very obscure way to explain the rewrite, even when it's consistent with some of the other tables.
I'll submit a strawman PR.