Skip to content

Disallow specializing bitset and ratio#5937

Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
frederick-vs-ja:no-bitset-ratio-specialization
Dec 8, 2025
Merged

Disallow specializing bitset and ratio#5937
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
frederick-vs-ja:no-bitset-ratio-specialization

Conversation

@frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Dec 5, 2025

std::bitset or std::ratio only take constant template parameters, so none of their specialization can depend on a type. As a result, although they are not explicitly disallowed to be specialized, it is impossible to provide any valid program-defined specialization.

It's not very clear to me whether it's OK to reject all program-defined ratio_add specializations and their friends. It seems that there can be valid program-defined ratio_add partial specializations that are always ill-formed on instantiation due to static_assert, which is squirrelly🐿️.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Dec 5, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Dec 5, 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
@StephanTLavavej StephanTLavavej merged commit df177d7 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

🙅 0️⃣ 1️⃣

@frederick-vs-ja frederick-vs-ja deleted the no-bitset-ratio-specialization branch December 9, 2025 03:30
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

None yet

Development

Successfully merging this pull request may close these issues.

3 participants