[Issue 2095] covariance w/o typechecks = bugs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 18 20:06:34 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2095
jason.james.house at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason.james.house at gmail.com
------- Comment #6 from jason.james.house at gmail.com 2009-02-18 22:06 -------
I don't know if it's wise to mark bug 2544 as a duplicate of this bug. For
example, the proposed solution (comment 3) shows a lack of understanding of
this related issue.
Specifically, I believe the proposed solution in bug 2412 comment 3 says the
following would be ok:
class base{}
class derived:base{}
derived[] x = new derived[2];
const(base)[] safe = x;
That really isn't true. Take the following code that should resize the arrays
in place:
derived[] x = new derived[2];
derived.length = 1;
const(base)[] safe = x;
x ~= new derived(); // x[1] is now valid derived instance
safe ~= new base(); // just overwrote x[1] with a non-derived instance
--
More information about the Digitalmars-d-bugs
mailing list