Cannot compare object.opEquals is not nogc

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 23 07:15:03 PDT 2016


On Saturday, 23 July 2016 at 13:18:03 UTC, Rufus Smith wrote:
> Trying to compare a *ptr value with a value in nogc code 
> results in the error:
>
> Error: @nogc function '...' cannot call non- at nogc function 
> 'object.opEquals'		
>
> Shouldn't object opEquals be marked?

If object.opEquals is marked @nogc, than all D classes must 
implement it as @nogc, because (of course) you cannot override a 
@nogc method with a not- at nogc one (while the opposite is 
possible, of course).
So marking it @nogc is not only a big breaking change, but also 
very limiting.


More information about the Digitalmars-d-learn mailing list