Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #280 (closed defect: fixed)

Opened 17 years ago

Last modified 17 years ago

Compile error using core.Array with classes

Reported by: larsivi Assigned to: sean
Priority: major Milestone: 0.97 RC 1
Component: Core Functionality Version: trunk
Keywords: Cc:

Description

The following program

import tango.core.Array;

void main()
{
    MyClass[] ar = new MyClass[2];
    auto mc1 = new MyClass();
    ar[0] = mc1;
    auto mc2 = new MyClass();
    ar[1] = mc2;

    ar.remove(mc1);

}

class MyClass
{

}

results in

tango/core/Array.d(33): Error: cannot implicitly convert expression (((cast(Object)(p1)).opEquals)(cast(Object)(p2))) of type int to bool

Reported by odeamus on #d.tango

Change History

02/14/07 19:55:05 changed by larsivi

This is due to Object.opEquals returning an int instead of the saner bool. We may change in Tango, but would like Phobos to change too since it will be a breaking change. See thread on subject in digitalmars.D newsgroup.

03/05/07 04:22:34 changed by kris

Nothing is gonna come of the NG post at this time, so that leaves us two options: ignore this issue, or fix opEqual

I'd vote for the latter

03/10/07 18:16:00 changed by sean

I'm currently planning to change opEqual whenever the implicit conversion rules are implemented, since should break some additional uses of opEqual anyway.

03/13/07 16:23:21 changed by kris

  • version changed from 0.95 beta 1 to trunk.
  • milestone changed from 0.96 Beta 2 to 0.97 RC 1.

03/23/07 22:15:03 changed by sean

  • status changed from new to closed.
  • resolution set to fixed.

I decided to implement a temporary fix for this problem so people can actually use the Array module until opEquals is re-evaluated. Relevant changeset is 1958.