D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22882 - Floating-point literals with leading zeroes incorrectly throw octal errors
Summary: Floating-point literals with leading zeroes incorrectly throw octal errors
Status: RESOLVED DUPLICATE of issue 22549
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-03-16 16:53 UTC by 8jst
Modified: 2022-03-18 16:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description 8jst 2022-03-16 16:53:09 UTC
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 Dlang Bot 2022-03-16 17:12:06 UTC
@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 8jst 2022-03-18 16:57:24 UTC

*** This issue has been marked as a duplicate of issue 22549 ***