https://issues.dlang.org/show_bug.cgi?id=22916
--- Comment #3 from Dennis <[email protected]> --- (In reply to Walter Bright from comment #1) > Although > the *ptr is not `scope`, because `scope` is not transitive, the compiler > transfers the `scope` to the return value because it is told to. No, my `return scope` annotation is correct. *ptr becomes `scope` again because I return it by `ref`, which is effectively taking the address which cancels out the dereference. If you mark `index` just `scope`, the compiler correctly complains about `return *ptr`: > Error: scope variable `this` may not be returned --
