digitalmars.D.bugs - [Issue 21807] New: Non-immutable data can be converted to immutable
- d-bugmail puremagic.com (32/32) Apr 06 2021 https://issues.dlang.org/show_bug.cgi?id=21807
https://issues.dlang.org/show_bug.cgi?id=21807 Issue ID: 21807 Summary: Non-immutable data can be converted to immutable using function call in ctor Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: temtaime gmail.com class Foo { this() { // char[12] pp; str = pp; // error str = bb(); // no error ??? } string str; } char[12] bb() { char[12] res; return res; } Also why it doesn't produce Error: escaping reference to stack allocated value returned by bb() ??? --
Apr 06 2021