[Mono-list] Possible mcs bug: CS0019 detected for comparable instances

Miguel de Icaza miguel@ximian.com
19 Oct 2003 21:15:05 -0400


> Yes, you're right, I think I jumped over that statement when I read the 
> spec... I filed the bug report because it works in Microsoft's csc, and I 
> missintepreted the following quote (also from 14.9.6):
> "It is a compile-time error to use the predefined reference type equality 
> operators to compare two "references that are known to be different at 
> compile-time."
> I got confused by the part that reads "...that are *known* to be different 
> at compile-time." In fact, as I wrote in a later email, is not possible to 
> state at compile-time if an object referenced through the interface of a 
> class not sealed implements another interface. But what I was missing is 
> that the quoted text is just an implication of the rule; just because two 
> references are _not known_ to be different at compile-time doesn't means 
> that is OK to compare them directly.
> Anyway, casting explicitly to "object" any of the two references that I'm 
> trying to compare does the trick.
> I apologise for the bug report, I should have been more careful and read the 
> spec thoroughly. Sorry for the inconvenience.

There is no need to apologize, we need to always look at the various
sides of the problem.  And your bug report was very good, please keep
the bug reports coming, am sure you will find various in Mono ;-)