`scope` checks are only enabled in @safe code because they might have false positives, and we don't want to break valid @system code, where we trust the programmer to get it right. However, blatantly returning a `scope` parameter could still be made an error. This is useful since @system is still the default and `scope` may be hidden behind `in`. ``` int* f(scope int* x) { return x; } const(int)* f(in int* x) // with -preview=in, it means `const scope` { return x; // may look innocuous } ``` This came up in the news group: https://forum.dlang.org/post/t7rfdm$1jjc$1@digitalmars.com https://forum.dlang.org/post/t88iuv$mbb$1@digitalmars.com
@dkorpel created dlang/dmd pull request #14221 "Fix 23191 - scope parameter can be returned in `@system` code" fixing this issue: - Fix 23191 - scope parameter can be returned in `@system` code https://github.com/dlang/dmd/pull/14221
dlang/dmd pull request #14221 "Fix 23191 - scope parameter can be returned in `@system` code" was merged into master: - d72e596128d4fc0ab928e3e86520e7d2fa54d14a by Dennis Korpel: Fix 23191 - scope parameter can be returned in `@system` code https://github.com/dlang/dmd/pull/14221