www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21666] New: wrong printf format specifier for `real` with

https://issues.dlang.org/show_bug.cgi?id=21666

          Issue ID: 21666
           Summary: wrong printf format specifier for `real` with
                    -checkaction=context on Win64
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

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);
```

--
Feb 27