Bug 22882 – Floating-point literals with leading zeroes incorrectly throw octal errors
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-16T16:53:09Z
Last change time
2022-03-18T16:57:24Z
Keywords
pull
Assigned to
No Owner
Creator
8jst
Comments
Comment #0 by 8jst — 2022-03-16T16:53:09Z
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.
Comment #1 by dlang-bot — 2022-03-16T17:12:06Z
@aposteriorist created dlang/dmd pull request #13827 "Fix issue 22882 - Floating-point literals with leading zeroes incorrectly throw octal errors" fixing this issue:
- Fix issue 22882: Floating-point leading zeroes bug
This is a simple fix to issue #22882, though I'm sure something cleaner could be done.
https://github.com/dlang/dmd/pull/13827
Comment #2 by 8jst — 2022-03-18T16:57:24Z
*** This issue has been marked as a duplicate of issue 22549 ***