[Issue 5207] Immutability is broken in constructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 29 10:37:45 UTC 2022


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

--- Comment #9 from RazvanN <razvan.nitu1305 at gmail.com> ---
Thinking more about this, isn't the idea of module constructors to not type
check qualifiers because it is considered that they are used to initialize data
before the program is actually run? For example, this works:

immutable int a;

shared static this()
{
    a = 2;
    a = 3;
}

I guess this should be documented.

--


More information about the Digitalmars-d-bugs mailing list