September 23 [Issue 24780] New: Errors in Using "alias this = arr" within a Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24780 Issue ID: 24780 Summary: Errors in Using "alias this = arr" within a Class Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: mzfhhhh@foxmail.com 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 []. -- |
Copyright © 1999-2021 by the D Language Foundation