www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7451] New: [Git regression] AAs broken for interfaces keys and values with opEquals

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7451

           Summary: [Git regression] AAs broken for interfaces keys and
                    values with opEquals
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: regression
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: code klickverbot.at



---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7451




---
(if TickDuration[Test] is used directly, DMD ICE's instead because the template
cannot be instantiated)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7451


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



23:07:47 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7451




---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7451


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



19:11:03 PST ---
*** This issue has been marked as a duplicate of issue 4088 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2012