This is a spin-off from issue 19175.
----
int* escape(int* r) @safe pure
{
return r;
}
int* f() @safe
{
int x = 42;
return escape(&x); /* Should not compile. */
}
----
Tested with v2.087.0 and v2.088.0-beta.1-46-g0459e34e (current git master).
Comment #1 by dlang-bot — 2020-03-15T10:09:41Z
@WalterBright created dlang/dmd pull request #10924 "fix Issue 20150 - -dip1000 return attribute must be explicit in pure …" fixing this issue:
- fix Issue 20150 - -dip1000 return attribute must be explicit in pure functions
https://github.com/dlang/dmd/pull/10924
Comment #2 by ag0aep6g — 2020-11-29T22:15:26Z
I'm changing the title back. `pure` does not imply `scope` parameters.
Comment #3 by dlang-bot — 2020-11-29T22:22:54Z
@aG0aep6G created dlang/dmd pull request #12010 "fix Issue 20150 - -dip1000 defeated by pure" fixing this issue:
- fix Issue 20150 - -dip1000 defeated by pure
https://github.com/dlang/dmd/pull/12010
Comment #4 by dkorpel — 2021-05-12T13:23:08Z
*** Issue 21291 has been marked as a duplicate of this issue. ***
Comment #5 by dkorpel — 2021-05-12T13:26:23Z
*** Issue 21912 has been marked as a duplicate of this issue. ***
Comment #6 by dlang-bot — 2021-05-14T10:34:04Z
@nordlow created dlang/dmd pull request #12520 "Fix pure scope" fixing this issue:
- fix Issue 20150 - -dip1000 return attribute must be explicit in pure functions
https://github.com/dlang/dmd/pull/12520
Comment #7 by dlang-bot — 2021-08-18T11:59:52Z
dlang/dmd pull request #12010 "fix Issue 20150 - -dip1000 defeated by pure" was merged into master:
- 5d5c2e3ca3814ea0064aa9241ab8ec938403aa2c by aG0aep6G:
fix Issue 20150 - -dip1000 defeated by pure
https://github.com/dlang/dmd/pull/12010
Comment #8 by dlang-bot — 2021-08-26T08:00:01Z
dlang/phobos pull request #8215 "Remove workaround for issue 20150" was merged into master:
- 53086d4ffcb381467644e5159667b593cfdf8eb5 by dkorpel:
remove workaround for issue 20150
https://github.com/dlang/phobos/pull/8215