On Thu, 10 Dec 2009 19:23:43 -0500, Richard Webb <[email protected]>
wrote:
I just tried to build the Juno library with DMD 2.037, and got a bunch
or errors like:
juno\com\core.d(295): Error: function juno.com.core.GUID.opEquals type
signature should be const bool(ref const(GUID)) not bool(GUID other)
Which can be replicated with:
////////////////////////////////
struct Foo
{
bool opEquals(Foo f) const
{
return true;
}
}
void Bar()
{
Foo f;
}
////////////////////////////////
It built ok with DMD2 a few months ago. Is this an intentional change?
It's due to this change: http://www.dsource.org/projects/dmd/changeset/260
The issue being fixed was this:
http://d.puremagic.com/issues/show_bug.cgi?id=3433
I think it should be a bug, because your opEquals does not violate const,
since you are making a copy of a Foo, and Foo contains no references.
Please file a bug and reference 3433 and changeset 260. I think it should
be allowed to have a signature like this:
bool opEquals(T other) const
inside T as long as T can be implicitly cast from const to mutable.
Also, while looking at the problem i noticed that code like:
////////////////////////////////
struct Foo
{
~this()
{
}
}
void Bar()
{
const Foo f;
}
////////////////////////////////
Produces the error:
Error: destructor Foo.~this () is not callable using argument types ()
which seems a bit wrong?
Yeah, that's weird. Probably something to do with const. Probably should
file another bug :)
-Steve