[Issue 10376] Glaring hole in const system

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 21 16:23:44 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=10376

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #6 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
This should be legal if the member variable is initialized with an immutable
value, since that doesn't create any holes in the type system. In fact, if it
weren't for issue# 12624, SysTime would have a default value for its timezone
which was immutable (with timezone being Rebindable!(immutable TimeZone) ). But
of course that requires that the member variable either be immutable or
something like Rebindable, immutable(T)*, or immutable(T)[] which can
point/refer to an immutable value but is not itself immutable.

However, it's definitely the case that this should be disallowed when the
initializer is mutable, and while it _could_ work with a const initializer
under some set of circumstances, it's way simpler to just disallow it.

--


More information about the Digitalmars-d-bugs mailing list