[all-commits] [llvm/llvm-project] aeecef: [libc++] Remove default definition of std::char_tr...

Louis Dionne via All-commits all-commits at lists.llvm.org
Wed Nov 23 06:51:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aeecef08c385b1e4955155dd649a2d3724463849
      https://github.com/llvm/llvm-project/commit/aeecef08c385b1e4955155dd649a2d3724463849
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-11-23 (Wed, 23 Nov 2022)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/include/__string/char_traits.h
    A libcxx/test/libcxx/strings/char.traits/char.traits.specializations/signed_unsigned_char.deprecated.verify.cpp
    A libcxx/test/libcxx/strings/char.traits/char.traits.specializations/signed_unsigned_char.pass.cpp
    M libcxx/test/std/ranges/range.adaptors/range.lazy.split/general.pass.cpp
    M libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list