Skip to content

<vector>: Avoid another compiler warning with Defect Report P2280R4 #5566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

StephanTLavavej
Copy link
Member

Followup to #5550.

When Defect Report WG21-P2280R4 is implemented in MSVC, for libcxx's pathological tests for allocators with tiny size_types like uint8_t, the compiler will notice that _Ints_max * _VBITS undergoes integral promotion, but isn't smart enough to realize that we've avoided actual truncation.

We should consistently follow our pattern of static_casting to avoid warnings with integral promotions.

@StephanTLavavej StephanTLavavej requested a review from a team as a code owner June 1, 2025 20:21
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 1, 2025
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Jun 1, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in STL Code Reviews Jun 1, 2025
Copy link
Member

@davidmrdavid davidmrdavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews Jun 2, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Jun 11, 2025
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit ac52118 into microsoft:main Jun 14, 2025
48 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Jun 14, 2025
@StephanTLavavej StephanTLavavej deleted the cast-is-an-anagram-of-cats branch June 14, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants