<vector>: Avoid off-by-default warning C4365 in vector<bool> copy algorithms with /J
#6013
+100
−80
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.
Reported by a major customer.
Our policy is that we attempt to be
/W4clean but not/Wallclean, as/Wallcontains a large number of extremely noisy warnings, many of which aren't suitable for using in production (some are intended for focused investigations, or were added for one unusual scenario, or were just way noisier than their value proved to be).However, we generally do attempt to keep the codebase clean with respect to the off-by-default warning C4365, as we build our tests with
/w14365:STL/tests/std/tests/prefix.lst
Line 6 in 4634ad4
Under the extremely obscure compiler option
/J,charis treated as an unsigned type. This triggers C4365 signed/unsigned mismatch warnings when assigning promotedinttocharin thevector<bool>optimization forcopy()implemented by #3353 (merged 2023-09-21, shipped in MSVC Build Tools 14.39 / VS 2022 17.9).Avoiding those warnings is easy, so even though
/Jis rarely used, and we don't officially support being C4365 clean, we may as well silence them and add test coverage.Enabling the test coverage is significantly more obnoxious but all of the issues were in the test itself and are avoidable with repetitive casts.