www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21958] New: windows: printf check requires mutable pointer

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

          Issue ID: 21958
           Summary: windows: printf check requires mutable pointer for %ls
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

import core.stdc.stdio;

void main()
{
    wchar* p = null;
    printf("%ls\n", p); // compiles
    const(wchar)* cp = null;
    printf("%ls\n", cp); // complains
}

printf_test.d(9): Deprecation: argument `cp` for format specification `"%ls"`
must be `wchar_t*`, not `const(wchar)*`
printf_test.d(9): Deprecation: argument `cp` for format specification `"%ls"`
must be `wchar_t*`, not `const(wchar)*`

works if wchar_t is used, but this is just an alias to wchar on Windows.

--
May 23 2021