Cannot compare shared Objects

Simen kjaeraas simen.kjaras at gmail.com
Sun Sep 12 14:00:54 PDT 2010


Jacob Carlborg <doob at me.com> wrote:

> The following example doesn't compile with D2:
>
> class Foo
> {
>      private Object value;
>
>      synchronized bool hasValue (Object val)
>      {
>          return value == val;
>      }
> }
>
> It gives the error:
>
> main.d(11): Error: function object.opEquals (Object lhs, Object rhs) is  
> not callable using argument types (shared(Object),Object)
> main.d(11): Error: cannot implicitly convert expression (this.value) of  
> type shared(Object) to object.Object
>
> Is that because object.opEquals hasn't been overloaded with a shared  
> version yet? If that's the case has this already been reported in  
> bugzilla?

You're absolutely right about the cause. This is related to, though not the
same issue as, #1824 (http://d.puremagic.com/issues/show_bug.cgi?id=1824)
I'm unsure whether this should be added to #1824 or filed as a separate  
bug.

-- 
Simen


More information about the Digitalmars-d-learn mailing list