Cannot compare shared Objects

Jacob Carlborg doob at me.com
Mon Sep 13 01:13:09 PDT 2010


On 2010-09-12 23:00, Simen kjaeraas wrote:
> 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.

Filed as http://d.puremagic.com/issues/show_bug.cgi?id=4857

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list