Bug 24780 – Errors in Using "alias this = arr" within a Class

Status
NEW
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2024-09-23T07:52:44Z
Last change time
2024-12-13T19:37:30Z
Assigned to
No Owner
Creator
mzfhhhh
Moved to GitHub: dmd#18268 →

Comments

Comment #0 by mzfhhhh — 2024-09-23T07:52:44Z
Errors in Using alias this = arr within a Class ```d class A { int [] arr; alias arr this; } void main() { A a = new A; a ~= 1; writeln(a); // output: [1] writeln(a); // output err: [] } ``` When attempting to print the value of variable a for the second time, an error occurs, and the result is an empty array [].
Comment #1 by robert.schadek — 2024-12-13T19:37:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18268 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB