Bug 4628 – Casting away const should be allowed in safe mode if no indirection
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-08-11T19:36:00Z
Last change time
2011-06-11T01:01:22Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2010-08-11T19:36:45Z
void fun() @safe {
const uint foo = 2;
uint bar = foo; // Works.
auto bar = cast(uint) foo; // Doesn't work;
}
test9.d(4): Error: cast from const(uint) to uint not allowed in safe code
test9.d(4): Error: declaration test9.fun.bar is already defined
Comment #1 by yebblies — 2011-06-11T01:01:22Z
*** This issue has been marked as a duplicate of issue 5088 ***