struct S { string value; @safe this()(auto ref string val) { value = val; } } @safe S create(return string arg) { return S(arg); } --- The example above fails to compile, with the following error: Error: returning `S(null).this(arg)` escapes a reference to parameter `arg`, perhaps annotate with `return` Adding `scope return` to the constructor's parameter allows the example to compile successfully, which suggests that they are not being correctly inferred, even though the constructor is a template.
As of DMD v2.092.0 the given example compiles without errors.