<locale>: Repair std::collate<unsigned short>#5361
Merged
StephanTLavavej merged 7 commits intomicrosoft:mainfrom Apr 22, 2025
Merged
<locale>: Repair std::collate<unsigned short>#5361StephanTLavavej merged 7 commits intomicrosoft:mainfrom
<locale>: Repair std::collate<unsigned short>#5361StephanTLavavej merged 7 commits intomicrosoft:mainfrom
Conversation
tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp
Outdated
Show resolved
Hide resolved
StephanTLavavej
approved these changes
Apr 16, 2025
Member
|
Thanks! I updated the product code's preprocessor logic, pushed significant changes to the test, and updated the PR description accordingly - please meow if I messed something up. The general principle that we now follow (although our legacy codebase didn't) is that while |
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
|
Thanks for fixing the world's best library with the world's worst compiler option! 😹 💚 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This repairs
collate<unsigned short>by adding two missingunsigned shortspecializations for_LStrcolland_LStrxfrmwhen we're building the STL. Fixes #5236.There are similar specializations for a few functions in
<xlocale>. I guess_LStrcolland_LStrxfrmwere missed because they are located in a different header.Since
collateis the only user of these functions, I also moved them from<xlocinfo>to<locale>just abovecollate.As for why this also fixes
collate<wchar_t>=collate<unsigned short>under non-nativewchar_twhen linking to the DLL, this is because the the locale facets are constructed in the DLL here:STL/stl/src/wlocale.cpp
Lines 58 to 88 in f2a2933
Thus,
collate's virtual functions originate from the DLL as well. These virtual functions call_LStrcolland_LStrxfrm, but the specializations forunsigned shortwere missing since the DLL is built with nativewchar_t.In the new test, we have to skip
collate::transform()tests when there is IDL mismatch between TU and linked DLL.