This should fail to compile with dip1000:
ref int test(ref scope return int* p)
{
return *p;
}
p should be 'return ref` and `scope`, but the compiler interprets it as `ref` and `return scope` and passes it.
Comment #1 by dlang-bot — 2021-07-07T01:36:29Z
@WalterBright updated dlang/dmd pull request #12817 "fix Issue 21868 - DIP1000 doesn't catch pointer to struct temporary" fixing this issue:
- fix Issue 22108 - DIP1000 parameter mistakenly interpreted as return scope instead of scope
https://github.com/dlang/dmd/pull/12817
Comment #2 by bugzilla — 2022-02-18T23:21:22Z
What's happening is the value of p is being returned, and `return ref` and `scope` should prevent the value of p being returned.
Comment #3 by dlang-bot — 2022-05-17T19:53:50Z
dlang/dmd pull request #12817 "fix Issue 22108 - parameter mistakenly interpreted as return scope instead of scope" was merged into master:
- 815570c3e6085e9b062e1bf57c8951a734de166b by Walter Bright:
fix Issue 22108 - DIP1000 parameter mistakenly interpreted as return scope instead of scope
https://github.com/dlang/dmd/pull/12817