struct S {
static:
alias get this;
int get() {
return 0;
}
void opAssign(int) {
}
void opOpAssign(string op)(int) {
}
}
void main() {
int x = S; // pass
S = 42; // pass
S *= 42; // fail, should pass
}
Error: `get()` is not an lvalue and cannot be modified
opOpAssign call is resolved correctly if there is no 'static' or 'alias this'.
Comment #1 by robert.schadek — 2024-12-13T19:16:33Z