Comment #0 by default_357-line — 2020-03-13T10:13:35Z
Consider a struct S:
struct S { immutable int i; }
Even though it's nominally mutable, it contains no mutable fields.
However, if we have a "mutable" array:
S[] array = [S(5)];
We cannot convert this array to immutable(S)[]
immutable(S)[] array2 = array; // errors
Even though this is clearly safe, because S has no fields that could mutate or be mutated, whether you write `S` or `immutable(S)`.
This combines with https://issues.dlang.org/show_bug.cgi?id=20670 to make immutable arrays effectively unusable as struct members.
Comment #1 by robert.schadek — 2024-12-13T19:07:38Z