How use "toHash" without cast

Namespace rswhite4 at googlemail.com
Thu Jun 21 00:48:52 PDT 2012


> It's actually @trusted as per the docs. I do not know why DMD 
> infers that to be @safe.....
>
> In any case, the solution here is this:
>
>     override hash_t toHash() @trusted const pure nothrow {
>         return cast(hash_t)(this.x + this.y);
>     }

Yes, it's already trusted.

If I write "@trusted const pure nothrow" it works fine, but if i 
write "const pure nothrow" not. Why? I thought the compiler is 
orientating at the base method which is overriden.


More information about the Digitalmars-d-learn mailing list