Bug 21666 – wrong printf format specifier for `real` with -checkaction=context on Win64
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2021-02-27T15:25:33Z
Last change time
2021-03-15T22:21:44Z
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2021-02-27T15:25:33Z
When compiling this code on Windows with dmd -m64 -checkaction=context:
```
void main() {
assert(real(0.0) == 0.0);
}
```
You get:
C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\internal\dassert.d(186): Deprecation: argument cast(__c_long_double)v for format specification "%Lg" must be real, not double
Which points to this code in miniFormat():
```
import core.stdc.config : LD = c_long_double;
(...)
else static if (is(V == real))
len = sprintf(&val[0], "%Lg", cast(LD) v);
```
Comment #1 by moonlightsentinel — 2021-02-27T15:37:19Z
*** This issue has been marked as a duplicate of issue 20759 ***
Comment #3 by dlang-bot — 2021-03-06T07:31:38Z
dlang/druntime pull request #3389 "Fix 21666 - Remove deprecations w.r.t. real formatting for checkaction=context" was merged into stable:
- 1c57001ba741ea433670eb2877224920f21c8e76 by MoonlightSentinel:
Fix 21666 - Remove deprecations w.r.t. real formatting for...
...checkaction=context. These deprecations are issued when
`real.sizeof = double.sizeof`.
This is a workaround for https://issues.dlang.org/show_bug.cgi?id=20759.https://github.com/dlang/druntime/pull/3389
Comment #4 by dlang-bot — 2021-03-15T22:21:44Z
dlang/druntime pull request #3398 "Merge stable" was merged into master:
- 0d7ec8010fffba3ff002f750955e7f8db8e96089 by MoonlightSentinel:
Fix 21666 - Remove deprecations w.r.t. real formatting for...
...checkaction=context. These deprecations are issued when
`real.sizeof = double.sizeof`.
This is a workaround for https://issues.dlang.org/show_bug.cgi?id=20759.https://github.com/dlang/druntime/pull/3398