[libc++] Remove default definition of std::char_traits
This patch removes the base template implementation for std::char_traits.
If my reading of http://eel.is/c++draft/char.traits is correct, the
Standard mandates that the library provides specializations for several
types like char and wchar_t, but not any implementation in the base
template. Indeed, such an implementation is bound to be incorrect for
most types anyways, since things like `eof()` and `int_type` will definitely
have to be customized.
Since the base template implementation should not have worked for anyone,
this shouldn't be a breaking change (I expect that anyone defining a
custom character type today will already have to provide their own
specialization of char_traits). However, since we're aware of some users
of char_traits for unsigned char and signed char, we're keeping those two
specializations around for two releases to give people some time to migrate.
Differential Revision: https://reviews.llvm.org/D138307
NOKEYCHECK=True
GitOrigin-RevId: aeecef08c385b1e4955155dd649a2d3724463849
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index aac5d50..c731eab 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -100,8 +100,19 @@
- The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to
``_LIBCPP_ENABLE_DEBUG_MODE`` instead.
+- A base template for ``std::char_traits`` is not provided anymore. The Standard mandates that the library
+ provides specializations for several types like ``char`` and ``wchar_t``, which libc++ does. However, libc++
+ used to additionally provide a default implementation for ``std::char_traits<T>`` for arbitrary ``T``. Not
+ only does the Standard not mandate that one is provided, but such an implementation is bound to be incorrect
+ for some types, so it has been removed. As an exception, ``std::char_traits<unsigned char>`` and
+ ``std::char_traits<signed char>`` are kept for a limited period of time and marked as deprecated to let people
+ move off of those, since we know there were some users of those. They will be removed in LLVM 18.
+
Upcoming Deprecations and Removals
----------------------------------
+- The specializations of ``std::char_traits`` for ``unsigned char`` and ``signed char`` are provided until
+ LLVM 18. Those non-standard specializations are provided for a transition period and marked as deprecated
+ but will be removed in the future.
API Changes
-----------