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