[Issue 21959] New: 'alias this' takes precedence over static opOpAssign
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 23 14:54:07 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21959
Issue ID: 21959
Summary: 'alias this' takes precedence over static opOpAssign
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: maxsamukha at gmail.com
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'.
--
More information about the Digitalmars-d-bugs
mailing list