opCast using in template struct

Timon Gehr timon.gehr at gmx.ch
Thu Oct 18 15:07:54 PDT 2012


On 10/18/2012 11:45 PM, bearophile wrote:
> Era Scarecrow:
>
>> It's an easy mistake to make. Maybe the compiler should issue a
>> warning when opAssign attempts and fails and opOpBinary is defined.
>

This would have to be implemented very carefully. There are enough
hard to reproduce symbol resolution bugs already. It does not get
better by introducing hidden and unnecessary lookups.

> If you have strong feelings about this, then add a Bugzilla entry.
>
> There are other cases. Generally the D compiler should add some warnings
> that help against operator overloading mistakes.
>
> Bye,
> bearophile

I don't think that operator overloading gives rise to distinct mistakes.
For example, better error messages that just specify the expected name,
as in other cases of undefined identifiers, would already fix this.


More information about the Digitalmars-d-learn mailing list