[Issue 4702] Long Postfix not working with cross-module overloading

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 21 17:53:30 PST 2012


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



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-01-21 17:53:28 PST ---
I think what's going on is DMD figures out the literal can fit into an int and
does the optimization where it converts it into an int behind the scenes. 

Proof is in the pudding:

import std.stdio;
import foo;
import bar;

void main()
{
    long x;
    fun(cast(long)2147483648);  // ok, int.max is 2147483647, overflows to long
    fun(cast(long)2147483647);  // error, no overflow and literal stored as int
}

-- 
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