Skip to content

<string>: Fix handling for char_traits<unicorn>#4951

Merged
StephanTLavavej merged 7 commits intomicrosoft:mainfrom
frederick-vs-ja:char_traits-unicorn
Sep 19, 2024
Merged

<string>: Fix handling for char_traits<unicorn>#4951
StephanTLavavej merged 7 commits intomicrosoft:mainfrom
frederick-vs-ja:char_traits-unicorn

Conversation

@frederick-vs-ja
Copy link
Contributor

Fixes #4930. Ideally, when T is an implementation-controlled type, special handling should be enabled for char_traits<T> to reject more unintended element types. But the complete work is impractical, so this PR restricts the handling to arithmetic types and nullptr_t.

Drive-by changes:

  • Update the static_assert message to mention char8_t.
  • Resolve TRANSITION comments in <regex>, but test coverage is currently missing (which would be complicated and weird).

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner September 12, 2024 16:36
@CaseyCarter CaseyCarter added the bug Something isn't working label Sep 12, 2024
@StephanTLavavej StephanTLavavej removed their assignment Sep 19, 2024
@StephanTLavavej StephanTLavavej self-assigned this Sep 19, 2024
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit 5af09e7 into microsoft:main Sep 19, 2024
@StephanTLavavej
Copy link
Member

🧵 🦄 🛠️

@frederick-vs-ja frederick-vs-ja deleted the char_traits-unicorn branch September 19, 2024 23:10
// signed char and other unsigned integral types are supported as an extension.
// Use of other arithmetic types and nullptr_t should be rejected.
template <class _Ty>
constexpr bool _Is_implementation_handled_char_like_type = is_arithmetic_v<_Ty> || is_null_pointer_v<_Ty>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I came from the future to ask: why exactly is_arithmetic_v<_Ty> || is_null_pointer_v<_Ty>? Can we limit to is_integral<_Ty> ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it, that are impossible to specialize

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

None yet

Development

Successfully merging this pull request may close these issues.

<string>: basic_string<unicorn>::find_meow_of family with std::char_traits<unicorn> specialization are not supported

4 participants