March 16, 2010 [Issue 3977] New: Should disable implicit conversion of B[] to A[] when B is derived from A | ||||
---|---|---|---|---|
| ||||
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: nobody@puremagic.com ReportedBy: bugzilla@digitalmars.com --- Comment #0 from Walter Bright <bugzilla@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: ------- |
March 16, 2010 [Issue 3977] Should disable implicit conversion of B[] to A[] when B is derived from A | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | http://d.puremagic.com/issues/show_bug.cgi?id=3977 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy@yahoo.com Resolution| |DUPLICATE --- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-03-16 14:23:00 PDT --- Been around for a while. *** This issue has been marked as a duplicate of issue 2095 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation