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

           Summary: Should disable implicit conversion of B[] to A[] when
                    B is derived from A
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bugzi...@digitalmars.com


--- Comment #0 from Walter Bright <bugzi...@digitalmars.com> 2010-03-16 
14:17:50 PDT ---
This exposes a potential memory corruption problem:

class A {}
class B : A {}
void proc(A[] x, A y) {
    x[0] = y;
}
void main() {
    B[] anArrayOfB = new B[5];
    A a = new A();
    proc(anArrayOfB, a);
}

The solution is to disable implicit conversion of B[] to A[], but B[] to
const(A)[] and immutable(B)[] to immutable(A)[] should be allowed.

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

Reply via email to