Bug 7451 – [Git regression] AAs broken for interfaces keys and values with opEquals
Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-06T12:14:00Z
Last change time
2012-02-08T19:11:03Z
Keywords
ice
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2012-02-06T12:14:17Z
Very similar to issue 7365, using DMD and druntime from Git, this program
---
struct TickDuration {
bool opEquals(ref const TickDuration rhs) const {
return true;
}
}
interface Test {}
AssociativeArray!(TickDuration, Test) aa;
---
fails with
---
object.di(379): Error: function object.opEquals (const(Object) lhs, const(Object) rhs) is not callable using argument types (const(Test),const(Test))
object.di(379): Error: cannot implicitly convert expression (this.value) of type const(Test) to object.Object
object.di(379): Error: cannot implicitly convert expression (p.value) of type const(Test) to object.Object
---
The error is encountered while generating the default opEquals for the Slot
type added in
https://github.com/D-Programming-Language/druntime/commit/cd7b477b83cc8a75a90258bd2ab63fa8c92ba10b.
Comment #1 by code — 2012-02-06T12:20:37Z
(if TickDuration[Test] is used directly, DMD ICE's instead because the template cannot be instantiated)
Comment #2 by bugzilla — 2012-02-07T23:07:47Z
Is this really a regression?
Note that this also similarly fails:
----
interface Test {}
bool foo(Test x, Test y) {
return x == y;
}
----
foo2.d(6): Error: function object.opEquals (const(Object) lhs, const(Object) rhs) is not callable using argument types (Test,Test)
Because an interface cannot be implicitly converted to an Object:
----
interface Test {}
Object foo(Test x) {
return x;
}
----
foo2.d(6): Error: cannot implicitly convert expression (x) of type foo2.Test to object.Object
Comment #3 by code — 2012-02-08T09:36:10Z
The question is whether interfaces can be used as AA keys. They could in 2.057 and before, and can't quite now, hence I marked it as regression.
Comment #4 by bugzilla — 2012-02-08T19:11:03Z
*** This issue has been marked as a duplicate of issue 4088 ***