Skip to content

Conversation

@smundhra-git
Copy link
Contributor

@smundhra-git smundhra-git commented Dec 7, 2025

Fixes #5916, the issue where cv-qualified integer types (e.g., const int, volatile unsigned int) were incorrectly accepted as standard integer types. When the standard says "signed or unsigned integer type" or "standard integer type", only cv-unqualified versions are included.

Changes

  • Removed remove_cv_t wrapper from _Is_standard_integer in stl/inc/utility (line 952)
  • Removed remove_cv_t wrapper from _Is_standard_unsigned_integer in stl/inc/__msvc_bit_utils.hpp (line 312)

Impact

This fix ensures that:

  • std::cmp_less<const int, const int> is correctly rejected
  • std::extents<const int, 42> is correctly rejected
  • Bit manipulation functions in <bit> correctly reject cv-qualified types
static_assert(std::cmp_less<const int, const int>(0, 1)); // should be rejected
static_assert(sizeof(std::extents<const int, 42>)); // should be rejected

Checklist

  • Identifiers follow _Ugly naming convention (no changes needed - using existing identifiers)
  • No ABI breaks introduced
  • Changes are based on CWG-251 and the C++ Working Draft
  • All affected code paths updated (utility and bit_utils)

@smundhra-git smundhra-git requested a review from a team as a code owner December 7, 2025 01:55
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Dec 7, 2025
@smundhra-git
Copy link
Contributor Author

@microsoft-github-policy-service agree [company="Centren Health"]

@smundhra-git
Copy link
Contributor Author

@microsoft-github-policy-service agree

@smundhra-git

This comment was marked as resolved.

@AlexGuteniev

This comment was marked as resolved.

@StephanTLavavej StephanTLavavej added the bug Something isn't working label Dec 7, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Work In Progress in STL Code Reviews Dec 7, 2025
@vmichal
Copy link
Contributor

vmichal commented Dec 7, 2025

Also, @smundhra-git , write something like "fixes #5916" to make GitHub recognize that the given issue should be automatically closed when this PR is accepted. It also displays the issue differently in the list of issues.

@StephanTLavavej StephanTLavavej moved this from Work In Progress to Initial Review in STL Code Reviews Dec 7, 2025
@StephanTLavavej StephanTLavavej changed the title fix issue #5916 Remove remove_cv_t from standard integer type checks Remove remove_cv_t from standard integer type checks Dec 7, 2025
@StephanTLavavej
Copy link
Member

As @vmichal noted, I've gone ahead and edited your PR description to use GitHub's close/fix/resolve syntax, and removed the issue number from the PR title (as it doesn't turn into a link there, and isn't directly informative).

@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Dec 7, 2025
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Dec 7, 2025
@smundhra-git

This comment was marked as resolved.

@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Dec 8, 2025
@smundhra-git smundhra-git reopened this Dec 8, 2025
@github-project-automation github-project-automation bot moved this from Done to Initial Review in STL Code Reviews Dec 8, 2025
@frederick-vs-ja

This comment was marked as resolved.

@smundhra-git

This comment was marked as resolved.

@StephanTLavavej StephanTLavavej moved this from Initial Review to Merging in STL Code Reviews Dec 8, 2025
@StephanTLavavej StephanTLavavej merged commit c4d3fba into microsoft:main Dec 8, 2025
45 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Dec 8, 2025
@StephanTLavavej
Copy link
Member

Thanks for improving our conformance here, and congratulations on your first microsoft/STL commit! 😻

This will ship in the MSVC Build Tools 14.51, in a future update to VS 2026 18.x.

By the way, it looks like you might be creating commits with an email address that isn't associated with your GitHub account. You can easily link them up so that the commits appear to come from you either way. I do this myself, as my personal machine is configured to create commits with my personal email address, versus my work machine with work email. Click on your avatar in the upper-right of GitHub > Settings > Emails, then add a secondary email address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

<utility>: Cv-qualified integer types are incorrectly accepted in some places

6 participants