www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10806] New: Interface covariance for more than one interface at once also broken

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

           Summary: Interface covariance for more than one interface at
                    once also broken
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: default_357-line yahoo.de



22:36:01 PDT ---
After bug 10785, Infiltrator on #d simplified the testcase a lot.

http://dpaste.dzfl.pl/e9df03f9

Whatever DMD is doing to convert object types to interface types for covariant
interface inheritance, it seems to always use the first interface that is being
implemented with an override, even when emitting the vtable for the second one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10806




PDT ---
Code and output for easy perusal.

----------------------
import std.stdio;

interface A1 { A1 foo(); }
interface A2 { A2 foo(); }

class C1 : A1, A2 {
  override C1 foo() { return new C1; }
}

interface B1 { B1 foo(); }
interface B2 { B2 foo(); }

class C2 : B2, B1 {
  override C2 foo() { return new C2; }
}

void main() {
  A2 x = new C1;
  A2 y = x.foo();
  writefln("X: %s", x.classinfo);
  writefln("Y: %s", y.classinfo);


  B2 a = new C2;
  B2 b = a.foo();
  writefln("A: %s", a.classinfo);
  writefln("B: %s", b.classinfo);
}
-----------------------
Application output:

X: f230.A2
Y: f230.A1
A: f230.B2
B: f230.B2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10806




Additional example:

http://dpaste.dzfl.pl/a390f1f4

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 21 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10806




01:54:04 PDT ---
 Additional example:
 
 http://dpaste.dzfl.pl/a390f1f4
That's not the same bug. The only issue with that code is that the compiler fails to warn you that the call to foo() is ambiguous. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2013