Bug 22993 – Missing quotes in octal literal hint

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-06T21:22:41Z
Last change time
2022-04-08T06:59:56Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2022-04-06T21:22:41Z
Forum post: https://forum.dlang.org/thread/[email protected] User code: auto w = 01777777777777777777777; Suggestion: std.conv.octal!1777777777777777777777 The suggestion fails with `Error: integer overflow` because the literal is assumed to be in base 10.
Comment #1 by dlang-bot — 2022-04-06T21:43:42Z
@MoonlightSentinel created dlang/dmd pull request #13958 "Fix 22993 - Suggest string overload of std.conv.octal" fixing this issue: - Fix 22993 - Suggest string overload of std.conv.octal The previously suggested integer overload has two drawbacks. The literal parsed as base 10 and hence can overflow for larger values that are only valid in base 8. It also requires additional CTFE because it converts the value to string. So add quotes to the literal in the error message to suggest the string overload. https://github.com/dlang/dmd/pull/13958
Comment #2 by dlang-bot — 2022-04-07T05:20:52Z
dlang/dmd pull request #13958 "Fix 22993 - Suggest string overload of std.conv.octal" was merged into stable: - d89e3f5ad2bd2fc5a988300e40cd2c3e14d1de02 by MoonlightSentinel: Fix 22993 - Suggest string overload of std.conv.octal The previously suggested integer overload has two drawbacks. The literal parsed as base 10 and hence can overflow for larger values that are only valid in base 8. It also requires additional CTFE because it converts the value to string. So add quotes to the literal in the error message to suggest the string overload. https://github.com/dlang/dmd/pull/13958
Comment #3 by dlang-bot — 2022-04-08T06:59:56Z
dlang/dmd pull request #13962 "merge stable" was merged into master: - a8073e12ac97c63e00f5e24d6ee4bea64e209ec9 by MoonlightSentinel: Fix 22993 - Suggest string overload of std.conv.octal The previously suggested integer overload has two drawbacks. The literal parsed as base 10 and hence can overflow for larger values that are only valid in base 8. It also requires additional CTFE because it converts the value to string. So add quotes to the literal in the error message to suggest the string overload. https://github.com/dlang/dmd/pull/13962