Bug 23928 – improve error msg: scope variable s assigned to non-scope parameter this calling abc
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-19T06:59:51Z
Last change time
2023-05-19T09:14:25Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2023-05-19T06:59:51Z
The code:
struct S {
int* p;
void abc(int i) @safe { }
}
void test() @safe {
int i;
S s;
s.p = &i;
s.abc(1);
}
compiled with -preview=dip1000 produces the message:
test.d(13): Error: scope variable `s` assigned to non-scope parameter `this` calling `abc`
A better message would be:
Error: scope variable `s` calling non-scope member function `abc`
Comment #1 by dlang-bot — 2023-05-19T07:27:41Z
@WalterBright created dlang/dmd pull request #15249 "fix Issue 23928 - improve error msg: scope variable s assigned to non…" fixing this issue:
- fix Issue 23928 - improve error msg: scope variable s assigned to non-scope parameter this calling abc
https://github.com/dlang/dmd/pull/15249
Comment #2 by dlang-bot — 2023-05-19T09:14:25Z
dlang/dmd pull request #15249 "fix Issue 23928 - improve error msg: scope variable s assigned to non…" was merged into master:
- 6e4b469ec7af3d508c96605a93216432460a162b by Walter Bright:
fix Issue 23928 - improve error msg: scope variable s assigned to non-scope parameter this calling abc
https://github.com/dlang/dmd/pull/15249