Bug 22549 – importC: float literal should support leading zero

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-27T10:11:13Z
Last change time
2022-03-18T16:57:24Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Dennis

Comments

Comment #0 by dkorpel — 2021-11-27T10:11:13Z
See: https://forum.dlang.org/post/[email protected] 08.0 and 009.0 are valid float literals in C, but dmd says: > Error: octal digit expected, not `8`
Comment #1 by lance — 2021-11-27T13:14:02Z
This is not just an ImportC bug. DMD does the same with D code. According to run.dlang.io, this code void main() { double x = 08.4; } results in Up to 2.064 : Failure with output: onlineapp.d(3): Error: semicolon expected, not '8.4' 2.065.0 to 2.081.2: Success and no output 2.082.1: Failure with output: onlineapp.d(3): Error: radix 8 digit expected, not `8` Since 2.083.1: Failure with output: onlineapp.d(3): Error: octal digit expected, not `8` Something changed in 2.082.1 and 2.083.1 to cause a double with leading zero to be detected as octal.
Comment #2 by dlang-bot — 2021-11-29T19:03:10Z
@dkorpel created dlang/dmd pull request #13371 "Fix issue 22549 - float literal should support leading zero" fixing this issue: - Fix issue 22549 - float literal should support leading zero https://github.com/dlang/dmd/pull/13371
Comment #3 by b2.temp — 2021-11-30T06:10:50Z
the fix affects the specs https://dlang.org/spec/lex.html#LeadingDecimal, hence everything that would be based on them. I suggest to only allow leading zeroes in importC mode.
Comment #4 by b2.temp — 2021-11-30T06:27:51Z
also no reason to target stable(In reply to Basile-z from comment #3) > the fix affects the specs https://dlang.org/spec/lex.html#LeadingDecimal, > hence everything that would be based on them. > > I suggest to only allow leading zeroes in importC mode. sorry about that comment, as explained here https://issues.dlang.org/show_bug.cgi?id=3251, that is not required.
Comment #5 by dlang-bot — 2021-12-01T15:20:51Z
dlang/dmd pull request #13371 "Fix issue 22549 - float literal should support leading zero" was merged into stable: - 8a7b98b6228b3ac4d064d95f4a530130fb5824e6 by dkorpel: Fix issue 22549 - float literal should support leading zero https://github.com/dlang/dmd/pull/13371
Comment #6 by dlang-bot — 2021-12-14T10:34:31Z
dlang/dmd pull request #13421 "merge stable" was merged into master: - 6931b4e621057e95198670d78e663e530850c789 by dkorpel: Fix issue 22549 - float literal should support leading zero https://github.com/dlang/dmd/pull/13421
Comment #7 by 8jst — 2022-03-18T16:57:24Z
*** Issue 22882 has been marked as a duplicate of this issue. ***