[Issue 20728] New: There is third way to create immutable data
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 11 01:33:46 UTC 2020
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 at puremagic.com
Reporter: porton at 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.
--
More information about the Digitalmars-d-bugs
mailing list