[Issue 5207] Immutability is broken in constructors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 19 16:34:56 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=5207
hsteoh at quickfur.ath.cx changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |---
--- Comment #5 from hsteoh at quickfur.ath.cx ---
Are you sure? I think the complaint here is that `i` should only be
initializable once in the ctor, and should not be readable until then.
Otherwise, while inside the ctor immutability is violated, and strange things
can happen (e.g., the ctor can call a function that receives an immutable
value, then mutate it afterwards, causing an inconsistent state).
The fact that the ctor can initialize the immutable is not the complaint here.
--
More information about the Digitalmars-d-bugs
mailing list