[Issue 4251] Hole in the const system: immutable values can be overwritten (const(T) is appendable to const(T)[])

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 18 05:29:20 PST 2011


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


Luther Tychonievich <lat7h at virginia.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Hole in the type system:    |Hole in the const system:
                   |Base type reference can be  |immutable values can be
                   |assigned to subtype         |overwritten (const(T) is
                   |reference (Super* is        |appendable to const(T)[])
                   |treated as a supertype of   |
                   |Sub*)                       |


--- Comment #17 from Luther Tychonievich <lat7h at virginia.edu> 2011-11-18 05:28:26 PST ---
(In reply to comment #16)
>     B x;
>     A* y=&x; // bad!
Everything you describe is supposed to happen. "A* y = &x" is the point of
inheritance. What exactly is the problem you see in the above? All of your
assert elements seem fine too…

Reverting title. This bug is about the const safety design of the language, not
about inheritance. Even if there is a problem with inheritance, it should be a
separate bug unless you can argue they have the same cause.

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


More information about the Digitalmars-d-bugs mailing list