www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22014] New: Wrong MSVC++ mangling of wchar_t

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

          Issue ID: 22014
           Summary: Wrong MSVC++ mangling of wchar_t
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

C++:

```
#include <windows.h>

void wchar_test(wchar_t bla) {}
void wstr_test(LPCWSTR str) {}
```

=> (https://cpp.godbolt.org/z/qGo3roaqh)

?wchar_test  YAX_W Z
?wstr_test  YAXPEB_W Z

The frontend as of 2.097.0 mangles it as (https://d.godbolt.org/z/vhb96c1j3):

?wchar_test  YAX_S Z
?wstr_test  YAXPEB_S Z

The bug is
https://github.com/dlang/dmd/blob/a9efb98285713dac64a35e9eb166119d33d5fdc2/src/dmd/cppmanglewin.d#L248.

--
Jun 10 2021