[Issue 13606] New: erroneous overflow error in negative long literal

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 12 05:51:17 PDT 2014


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 at puremagic.com
          Reporter: ketmar at 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. ;-)

--


More information about the Digitalmars-d-bugs mailing list