www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13606] New: erroneous overflow error in negative long literal

https://issues.dlang.org/show_bug.cgi?id=13606

          Issue ID: 13606
           Summary: erroneous overflow error in negative long literal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ketmar ketmar.no-ip.org

the following code fails to compile with message "Error: signed integer
overflow", but -9223372036854775808L is correct negative value for long:

  long n = -9223372036854775808L;

for those who are as lazy as me: -9223372036854775808L is
-0x8000_0000_0000_0000L. this is valid negative value, albeit somewhat special,
as it has no corresponding positive value. ;-)

--
Oct 12 2014