I found a strange behavior.

class A {
    void opAssign(int v) {}
}

class Test {
    A a;
    this() {
        a = new A(); // removing this causes compile error.
a = 3; // cannot implicitly convert expression `3` of `int` to `A`
    }
}

void main() {
    // this is allowed.
    A a;
    a = 3;
}

Is it a compiiler's bug?

Reply via email to