[Issue 15660] breack "immutable" with pure function and mutable params
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Feb 8 14:07:22 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15660
--- Comment #1 from Iakh <iaktakh at gmail.com> ---
Also this works
import std.stdio;
class A
{
int i;
}
class B : A {}
struct S
{
A a;
auto f() pure @safe
{
B b = new B;
a = b;
return b;
}
}
void main() @safe
{
S s;
immutable a = s.f();
A b = s.a;
writeln(a.i);
b.i = 1;
writeln(a.i);
}
--
More information about the Digitalmars-d-bugs
mailing list