On Wednesday, 30 July 2025 at 18:00:39 UTC, H. S. Teoh wrote:
On Wed, Jul 30, 2025 at 10:54:15AM -0600, Jonathan M Davis via Digitalmars-d-learn wrote: [...]
immutable int[] i;

shared static this()
{
    immutable(int)[] temp;
    temp ~= foo();
    temp ~= bar();
    i = temp;
}

But even the shared static constructor isn't allowed to mutate the value of i. It's allowed to initialize it exactly once.
[...]

In that case, there is a bug:

```
static immutable int[] data;
shared static this() {
        data = [ 1 ];
        data = [ 2 ];   // should not compile, but currently does
}
```


T

please dont "fix" that; navigating the ct-gc type system is a bit tricky as is Id hate to see one of the useful bugs be destoried on accident

Reply via email to