www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22882] New: Floating-point literals with leading zeroes

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

          Issue ID: 22882
           Summary: Floating-point literals with leading zeroes
                    incorrectly throw octal errors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: 8jst queensu.ca

Floating-point literals with leading zeroes incorrectly throw an octal digit
error, as follows:

writeln(07.0); // 7
writeln(08.0); // Error: octal digit expected, not `8`
writeln(010.9); // 10.9
writeln(018.9); // Error: octal digit expected, not `8`
writeln(00077777.0); // 77777
writeln(00077778.0); // Error: octal digit expected, not `8`


The error is in lexer.d; errorDigit is set in number() in the initial switch
case, but when a '.' is subsequently handled later in the function, the error
state is never unset.

--
Mar 16 2022