Bug 24051 – Safety attrib inference of enum/immut/const decls inconsistent with mutable static variable decls

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-07-19T19:19:06Z
Last change time
2023-07-27T00:14:58Z
Keywords
accepts-invalid, pull, safe
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2023-07-19T19:19:06Z
this code is accepted without deprecation ```d enum uint* ptr = cast(uint*)0xC00000; // same with const/immut instead of enum void main() @safe { import core.volatile : volatileStore; volatileStore(ptr, 8); } ``` But ``` uint* ptr = cast(uint*)0xC00000; void main() @safe { import core.volatile : volatileStore; volatileStore(ptr, 8); } ``` with -de, is rejected with > Deprecation: cannot access `@system` variable `ptr` in @safe code Maybe there should be a deprecation message in all the cases.
Comment #1 by dlang-bot — 2023-07-20T10:32:07Z
@dkorpel created dlang/dmd pull request #15434 "Fix 24051 - Safety attrib inference of enum/immut/const decls" fixing this issue: - Fix 24051 - Safety attrib inference of enum/immut/const decls https://github.com/dlang/dmd/pull/15434
Comment #2 by dlang-bot — 2023-07-27T00:14:58Z
dlang/dmd pull request #15434 "Fix 24051 - Safety attrib inference of enum/immut/const decls" was merged into master: - 76fd4c843eb9562dd6ed040bad215e7d73414db1 by Dennis Korpel: Fix 24051 - Safety attrib inference of enum/immut/const decls https://github.com/dlang/dmd/pull/15434