www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 230] New: long.min cannot be parsed

reply d-bugmail puremagic.com writes:
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
}


-- 
Jun 28 2006
next sibling parent reply d-bugmail puremagic.com writes:
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?


-- 
Jun 28 2006
parent BCS <BCS pathlink.com> writes:
 OTOH: should it be?

edit: OTOH: should it be /allowed/?
Jun 28 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
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.


-- 
Jun 28 2006
prev sibling parent d-bugmail puremagic.com writes:
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.


-- 
Jul 08 2006