digitalmars.D.bugs - [Issue 3977] New: Should disable implicit conversion of B[] to A[] when B is derived from A
- d-bugmail puremagic.com (30/30) Mar 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3977
- d-bugmail puremagic.com (13/13) Mar 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3977
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 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: -------
Mar 16 2010
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 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: -------
Mar 16 2010