digitalmars.D.bugs - [Issue 1712] New: vtbl[0] for interface not set to corresponding Interface*
- d-bugmail puremagic.com (27/27) Dec 02 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1712
- d-bugmail puremagic.com (11/11) Jan 19 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1712
- d-bugmail puremagic.com (26/26) Jan 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1712
- d-bugmail puremagic.com (7/7) Jan 21 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1712
- d-bugmail puremagic.com (9/9) May 11 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1712
http://d.puremagic.com/issues/show_bug.cgi?id=1712 Summary: vtbl[0] for interface not set to corresponding Interface* Product: D Version: 2.008 Platform: PC OS/Version: Linux Status: NEW Keywords: spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: dhasenan gmail.com From the spec: """ struct Interface; Information about an interface. A pointer to this appears as the first entry in the interface's vtbl[]. """ By implication, the vtbl has to be a void* array of length one, and the first entry must be non-null. --- interface IFoo {}; writefln("%x", IFoo.classinfo.vtbl.ptr); // prints '0' --- --
Dec 02 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1712 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from bugzilla digitalmars.com 2008-01-20 00:48 ------- The vtbl[] for an interface is not in the interface's classinfo, as the vtbl[] is not generated by the interface definition, but by the class definition that implements the interface. --
Jan 19 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1712 dhasenan gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | ------- Comment #2 from dhasenan gmail.com 2008-01-20 10:53 ------- So you're saying that the Interface* should appear in the vtbl of each implementing class? Like this: --- interface IFoo {} class Foo : IFoo {} // Foo implements one more interface than Object, so its vtbl includes // one Interface* that Object doesn't. Nothing else is specific to Foo. assert(Object.classinfo.vtbl.length + 1 == Foo.classinfo.vtbl.length); --- Except that doesn't work. I understand that the vtbl of an interface should not include any function pointers. However, the spec says it should hold an Interface*. http://www.digitalmars.com/d/phobos/object.html if you want the link. Either the spec is incorrect or the implementation is incorrect. If the spec is incorrect, then I cannot proxy certain objects, and you should alter the documentation. Or is there some other vtbl in which the Interface* should appear? If so, the documentation is far from clear on the matter and should be altered. --
Jan 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1712 ------- Comment #3 from dhasenan gmail.com 2008-01-21 09:13 ------- Please amend the documentation to say: "When an object is accessed via an interface, an Interface* appears as the first entry in its vtbl." Thanks to Bill Baxter for digging up a link related to this issue. --
Jan 21 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1712 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #4 from bugzilla digitalmars.com 2008-05-11 04:12 ------- Fixed dmd 1.029 and 2.013 --
May 11 2008