Bug 21959 – 'alias this' takes precedence over static opOpAssign

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2021-05-23T14:54:07Z
Last change time
2024-12-13T19:16:33Z
Assigned to
No Owner
Creator
Max Samukha
Moved to GitHub: dmd#19933 →

Comments

Comment #0 by maxsamukha — 2021-05-23T14:54:07Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19933 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB