Try inout: ---- import std.stdio; struct Inner { int field = 3; } struct Test { auto get() inout { return inner; } private Inner inner; } void main() { { Test test; test.get.field = 4; } { immutable Test test; writeln(test.get.field); } } ----