[Issue 5088] New: Cannot cast const(int) to long in @safe function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 20 15:25:18 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5088

           Summary: Cannot cast const(int) to long in @safe function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2010-10-20 15:24:31 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list