https://issues.dlang.org/show_bug.cgi?id=19125
Issue ID: 19125 Summary: IFTI and inout removes head mutability qualifier on by-val parameters Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: ali.akhtarz...@gmail.com >From here: https://forum.dlang.org/post/jxcohrtxsfkechfgw...@forum.dlang.org import std.stdio; struct W(T) { T t; } auto wrap0(T)(auto ref inout(T) t) { return inout(W!T)(t); } auto wrap1(T)(auto ref inout(T) t) { return t; } void main() { pragma(msg, typeof(wrap0("foo"))); // removes it pragma(msg, typeof(wrap1("bar"))); // keeps it immutable int i0; pragma(msg, typeof(wrap1(i0))); // keeps it string s0 = "baz"; pragma(msg, typeof(wrap0(s0))); // keeps it } prints: immutable(W!(char[])) immutable(string) immutable(int) W!string --