https://issues.dlang.org/show_bug.cgi?id=15660
--- Comment #1 from Iakh <iakt...@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); } --