Bug 5088 – Cannot cast const(int) to long in @safe function

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-10-20T15:24:00Z
Last change time
2011-06-26T16:27:58Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2010-10-20T15:24:31Z
Even though they are value types. It seems to want to you to do cast(const(long)) --- @safe: void foo5088(const(int)[] x) { long a = cast(long)x[0]; } void main() { int[2] a; a[] = 6; foo5088(a); } ---- bug.d(36): Error: cast from const(int) to ulong not allowed in safe code
Comment #1 by yebblies — 2011-06-08T22:10:02Z
Comment #2 by yebblies — 2011-06-11T01:01:22Z
*** Issue 4628 has been marked as a duplicate of this issue. ***
Comment #3 by yebblies — 2011-06-11T01:01:40Z
*** Issue 4689 has been marked as a duplicate of this issue. ***
Comment #4 by yebblies — 2011-06-11T07:37:11Z
Comment #5 by bugzilla — 2011-06-26T16:27:58Z