To my understanding the code below should work, however the assert fails.
module main;
void main()
{
void a () {}
void b () {}
auto array = [&b, &a];
auto array2 = [&b, &a];
for (auto i = 0; i < 2; i++)
assert(array[i] == array2[i]);
assert(array == array2); // Assert failure
}
Comment #1 by ketmar — 2015-11-20T12:32:41Z
and a fix:
diff --git a/src/object.d b/src/object.d
index 4ce7670..84de07a 100644
--- a/src/object.d
+++ b/src/object.d
@@ -770,6 +770,12 @@ class TypeInfo_Delegate : TypeInfo
return c && this.deco == c.deco;
}
+ override bool equals(in void* p1, in void* p2) const
+ {
+ alias dg = void delegate (int);
+ return *cast(dg *)p1 == *cast(dg *)p2;
+ }
+
// BUG: need to add the rest of the functions
override @property size_t tsize() nothrow pure const