<format>: Fix signed/unsigned mismatch in _In_bounds
#1875
Merged
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 reimplements
<format>'s_In_boundswith C++20in_rangeto fix VSO-1314150 "[RWC][Regression][prod/fe][std:c++latest] Google_Snappy/Glslang/ITK failed with warning C4018". (I haven't personally reproed this warning, but the messages clearly indicate_In_bounds, and C++20in_rangeshould completely avoid such warnings in addition to having an optimal implementation.)We need
_Make_standard_integerto map any character types (char,wchar_t,char8_t,char16_t,char32_t) to the signed/unsigned integer types ([unsigned]char/short/int/long/long long) with the same signedness/width, because C++20in_rangerequires that. We specifically don't handlebool, which should never be given to_In_bounds(I checked the usage) and is rejected with a guaranteedstatic_assertby C++20in_range.warning C4018: '<=': signed/unsigned mismatch