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

--- Comment #0 from Walter Bright <> 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:
------- You are receiving this mail because: -------

Reply via email to