Bug 13785 – Integer literals are not getting widened
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-11-27T14:11:00Z
Last change time
2015-06-09T05:12:02Z
Keywords
industry
Assigned to
nobody
Creator
public
Comments
Comment #0 by public — 2014-11-27T14:11:19Z
```
const long A = 24L*60*60*1000*1000*10L;
const long B = 24*60*60*1000*1000*10L;
static assert(A == B);
```
applicable to both D1 and D2
Comment #1 by bearophile_hugs — 2014-11-27T14:55:49Z
(In reply to Dicebot from comment #0)
> ```
> const long A = 24L*60*60*1000*1000*10L;
> const long B = 24*60*60*1000*1000*10L;
> static assert(A == B);
> ```
>
> applicable to both D1 and D2
This bug report is already in Bugzilla. And Walter has even written a patch to fix it, but it's currently on hold because of a comment by Don.
Comment #2 by public — 2014-11-27T14:59:25Z
Can you please link a duplicate so that I can close this one properly?
Comment #3 by bearophile_hugs — 2014-11-27T15:10:00Z
Actually I am not sure if this is exactly the same thing. I don't want a warning for this snippet - I want it to actually work and assertion to pass.
Comment #5 by yebblies — 2014-12-31T07:36:26Z
(In reply to Dicebot from comment #4)
> Actually I am not sure if this is exactly the same thing. I don't want a
> warning for this snippet - I want it to actually work and assertion to pass.
Like... like floating point does? I don't think that would be a good idea. Having different rules for run-time and compile-time is pretty nasty.