April 03, 2022 [Issue 22978] New: Shared destructor is not able change immutable var but shared constructor can | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22978 Issue ID: 22978 Summary: Shared destructor is not able change immutable var but shared constructor can Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: apz28@hotmail.com struct X { Object o; } static immutable X x; shared static this() { x.o = new Object(); } shared static ~this() { x.o = null; // onlineapp.d(15): Error: cannot modify `immutable` expression `x.o` } -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply