struct D { const(char)[] d; this(scope const(char)[] d) @safe { this.d = "static_string"; } this(string d) @safe { this.d = d; } } D func(scope string s) @safe { return D(s); } --------- Error: scope variable s assigned to non-scope parameter d calling mir.exception.D.this Expected behavior: pass using `this(scope const(char)[] d)`
scope is deliberately not overloaded upon, as it would seem to be a very bizarre use case to do so. Adding this would require significant discussion and evaluation, including compelling use cases. I.e. a DIP would be needed.