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

           Summary: Assigning large const value to ulong type results in
                    "signed integer overflow"
           Product: D
           Version: D1 & D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw <ibuc...@ubuntu.com> 2010-07-21 13:50:16 PDT ---
The following code:

import std.stdio;
void main()
{
    ulong t;// = 18446744073709551615;
    printf("%llu\n", t.max);
}


Outputs:
18446744073709551615

However, I get a "signed integer overflow" when I try to assign the value
directly.

Code:
import std.stdio;
void main()
{
    ulong t = 18446744073709551615;
    printf("%llu\n", t);
}

Outputs:
bug.d(4): signed integer overflow

Using 'cast(ulong)18446744073709551615' doesn't help either, so I presume this
happens before D knows what datatype the large integer will be assigned to.

IMO, assignments of constant values within the range of foo.min to foo.max
should be allowed for all types.

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

Reply via email to