dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Fix Issue 22014 - Make core.stdc.stddef.wchar_t match C++ mangling

Open kinke opened this issue 1 year ago • 3 comments

Just like we already do in core.stdc.stdint.

kinke avatar Dec 16 '23 10:12 kinke

Thanks for your pull request and interest in making D better, @kinke! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
22014 normal Wrong MSVC++ mangling of wchar_t

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#15916"

dlang-bot avatar Dec 16 '23 10:12 dlang-bot

Blocked by apparently insufficient magic for these special enums, e.g.:

  • for the underlying 16-bit wchar on Windows:
    core\stdc\wchar_.d(128): Error: cannot implicitly convert expression `65535` of type `int` to `__c_wchar_t`
    
  • for the underlying 32-bit dchar on Linux:
    std/stdio.d(3248): Error: none of the overloads of template `std.utf.encode` are callable using argument types `!()(__c_wchar_t[1], immutable(dchar))`
    …
    std/utf.d(2510):                        `encode(Flag useReplacementDchar = No.useReplacementDchar)(out dchar[1] buf, dchar c)
    

kinke avatar Dec 16 '23 10:12 kinke

The same missing magic also blocks std::wstring from working in D (at least on windows, didn't test other OSes)

Herringway avatar Dec 16 '23 15:12 Herringway