On Monday, 11 January 2021 at 16:10:49 UTC, Steven Schveighoffer wrote:
There are some... odd rules.

struct S
{
[...]
immutable int e = 5; // stored in data segment, not per instance!

Are you sure?

struct S
{
    immutable int n = 123;
    this(int n) { this.n = n; }
}

void main()
{
    S s1;
    S s2 = 456;
    assert(s1.n == 123);
    assert(s2.n == 456);
}

Reply via email to