On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
    struct S {
        uint value;

        ~this() {

    const S a = S(12);
    S b = a;

You cannot assign a const element (`a`) to a non-const element (`b`) in `S b = a` expression. To make de assignment, you have to cast a to a non-constant expression:

S b = cast(S)a;

Or make `b` as const:

const S b = a;

Or, better, use auto keyword:

auto b = a;

Reply via email to