Bug 20658 – can modify overlapped storage classes in @safe enum function
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-09T23:49:14Z
Last change time
2020-03-10T01:21:28Z
Keywords
pull, safe
Assigned to
No Owner
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2020-03-09T23:49:14Z
This is correctly rejected:
----
union U
{
int m;
immutable int i;
}
U u;
void main() @safe
{
() @safe { u.m = 13; } ();
}
----
But factor the function literal out into an enum and DMD wrongly accepts it:
----
union U
{
int m;
immutable int i;
}
U u;
enum e = () @safe { u.m = 13; }; /* Should be the same error. */
void main() @safe
{
e();
}
----
Comment #1 by dlang-bot — 2020-03-10T00:15:56Z
@aG0aep6G created dlang/dmd pull request #10885 "fix issue 20658 - can modify overlapped storage classes in @safe enum…" fixing this issue:
- fix issue 20658 - can modify overlapped storage classes in @safe enum function
https://github.com/dlang/dmd/pull/10885
Comment #2 by dlang-bot — 2020-03-10T01:21:28Z
dlang/dmd pull request #10885 "fix issue 20658 - can modify overlapped storage classes in @safe enum…" was merged into master:
- e3b5149cd44d885c55769b301c8c5824e6f752fd by aG0aep6G:
fix issue 20658 - can modify overlapped storage classes in @safe enum function
https://github.com/dlang/dmd/pull/10885