April 11, 2020 [Issue 20728] New: There is third way to create immutable data | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20728 Issue ID: 20728 Summary: There is third way to create immutable data Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dlang.org Assignee: nobody@puremagic.com Reporter: porton@narod.ru https://dlang.org/spec/const3.html says that there are two ways of "Creating immutable data". I disagree, there is also the third way: auto int x = 1; void f(ref immutable int r) { } f(x); This is neither literal nor cast to immutable data. It is the third way. See also https://forum.dlang.org/post/lgkgcpxeyfrmuqlmigge@forum.dlang.org as a hint about the issue whether it actually creates immutable data. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply