Deprecating std::string<T> for non-character T

Libc++ used to provide a catch-all definition of std::char_traits that would “work” with non-character types. This was non-standard and the actual behavior of e.g. std::char_traits<unsigned long> is not something that was ever tested or even thought out.

We are deprecating std::char_traits with types other than char, wchar_t, char16_t, char32_t and char8_t, and that specialization will go away in LLVM 18. These changes are happening in ⚙ D138307 [libc++] Remove default definition of std::char_traits and ⚙ D138596 [libc++] Keep char_traits<T> for arbitrary T around until LLVM 18.

1 Like