Thread overview
[Issue 230] New: long.min cannot be parsed
Jun 28, 2006
d-bugmail
Jun 28, 2006
d-bugmail
Jun 28, 2006
BCS
Jun 28, 2006
d-bugmail
Jul 08, 2006
d-bugmail
June 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=230

           Summary: long.min cannot be parsed
           Product: D
           Version: 0.161
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: benoit@tionex.de


void main(){
        assert( +9223372036854775807L == long.max );
        assert( -9223372036854775807L == long.min );
        assert( -9223372036854775808L == long.min ); // signed integer overflow
}


-- 

June 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=230





------- Comment #1 from shro8822@uidaho.edu  2006-06-28 17:49 -------
Quoting the speck (lex.html)

Decimal Literal, L Suffix       Type
0L .. 9223372036854775807L      long

-(9223372036854775808L) is invalid b/c it is parsed as "- intLiteral"

Bug is not in DMD.

OTOH: should it be?


-- 

June 28, 2006
> OTOH: should it be?

edit: OTOH: should it be /allowed/?
June 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=230





------- Comment #2 from benoit@tionex.de  2006-06-28 18:27 -------
Seems to be according to the spec. But for me it is not logic that I can write 0x8000_0000_0000_0000L but not -9223372036854775808L.


-- 

July 08, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=230


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #3 from bugzilla@digitalmars.com  2006-07-08 16:36 -------
The compiler is behaving correctly. The - is applied after the numeric literal is processed, and 9223372036854775808L is out of range.


--