[Issue 6028] New: Cannot implicitly convert an array of class to an array of interface

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 18 09:16:33 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6028

           Summary: Cannot implicitly convert an array of class to an
                    array of interface
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-05-18 09:12:23 PDT ---
Test case:

----------------------------
interface X {}
class K : X {}
class L : K {}

void main() {
    L[] x;
    K[] y = x;  // ok
    X[] z = y;  // error
} 
----------------------------
test.d(8): Error: cannot implicitly convert expression (y) of type K[] to X[]
----------------------------

It should be possible to implicitly convert an array of class to an array of
(one of) its base interface type.

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


More information about the Digitalmars-d-bugs mailing list