Bug 20675 – dip1000 improper error about copying scope parameter into allocated memory
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-16T08:25:30Z
Last change time
2020-03-18T00:22:43Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2020-03-16T08:25:30Z
Compile with -preview=dip1000:
---
struct D {
int pos;
char* p;
}
void test(scope ref D d) @safe {
D[] da;
// works
const pos = d.pos;
da ~= D(pos, null);
// wrongly fails with
// Error: scope variable d may not be copied into allocate memory
da ~= D(d.pos, null);
}
---
Comment #1 by dlang-bot — 2020-03-16T22:11:03Z
@aG0aep6G created dlang/dmd pull request #10929 "fix issue 20675 - dip1000 improper error about copying scope paramete…" fixing this issue:
- fix issue 20675 - dip1000 improper error about copying scope parameter into allocated memory
https://github.com/dlang/dmd/pull/10929
Comment #2 by dlang-bot — 2020-03-17T08:46:09Z
@WalterBright created dlang/dmd pull request #10931 "fix Issue 20675 - dip1000 improper error about copying scope paramete…" fixing this issue:
- fix Issue 20675 - dip1000 improper error about copying scope parameter into allocated memory
https://github.com/dlang/dmd/pull/10931
Comment #3 by dlang-bot — 2020-03-18T00:22:43Z
dlang/dmd pull request #10929 "fix issue 20675 - dip1000 improper error about copying scope paramete…" was merged into master:
- 4b7eccf3430b2444b2158f8ba7e2954f3919d29e by aG0aep6G:
fix issue 20675 - dip1000 improper error about copying scope parameter into allocated memory
- b93c70082931b2c39b39819728a0f5f7afb16a83 by aG0aep6G:
move test for issue 20675 to test/compilable/scope.d
https://github.com/dlang/dmd/pull/10929