blob: c274f45c05eadbb58119fcdc56105922133f37fc [file] [log] [blame]
Hans Wennborg003a9982019-07-18 11:51:05 +00001=========================================
Tom Stellardf3752922022-07-26 19:43:55 -07002Libc++ 16.0.0 (In-Progress) Release Notes
Hans Wennborg003a9982019-07-18 11:51:05 +00003=========================================
Louis Dionne42222072018-09-06 14:46:22 +00004
5.. contents::
6 :local:
7 :depth: 2
8
Hans Wennborg3329a842018-09-10 08:57:12 +00009Written by the `Libc++ Team <https://libcxx.llvm.org>`_
Louis Dionne42222072018-09-06 14:46:22 +000010
11.. warning::
12
Tom Stellardf3752922022-07-26 19:43:55 -070013 These are in-progress notes for the upcoming libc++ 16 release.
Louis Dionne42222072018-09-06 14:46:22 +000014 Release notes for previous releases can be found on
Hans Wennborg3329a842018-09-10 08:57:12 +000015 `the Download Page <https://releases.llvm.org/download.html>`_.
Louis Dionne42222072018-09-06 14:46:22 +000016
17Introduction
18============
19
20This document contains the release notes for the libc++ C++ Standard Library,
Tom Stellardf3752922022-07-26 19:43:55 -070021part of the LLVM Compiler Infrastructure, release 16.0.0. Here we describe the
Louis Dionne42222072018-09-06 14:46:22 +000022status of libc++ in some detail, including major improvements from the previous
23release and new feature work. For the general LLVM release notes, see `the LLVM
Hans Wennborg3329a842018-09-10 08:57:12 +000024documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may
25be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
Louis Dionne42222072018-09-06 14:46:22 +000026
27For more information about libc++, please see the `Libc++ Web Site
Hans Wennborg3329a842018-09-10 08:57:12 +000028<https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_.
Louis Dionne42222072018-09-06 14:46:22 +000029
Hans Wennborgfc14f4e2020-01-15 10:02:56 +010030Note that if you are reading this file from a Git checkout or the
Louis Dionne42222072018-09-06 14:46:22 +000031main Libc++ web page, this document applies to the *next* release, not
32the current one. To see the release notes for a specific release, please
Hans Wennborg3329a842018-09-10 08:57:12 +000033see the `releases page <https://llvm.org/releases/>`_.
Louis Dionne42222072018-09-06 14:46:22 +000034
Tom Stellardf3752922022-07-26 19:43:55 -070035What's New in Libc++ 16.0.0?
Hans Wennborg003a9982019-07-18 11:51:05 +000036============================
Louis Dionne42222072018-09-06 14:46:22 +000037
Mark de Wever833949d2023-01-09 19:06:25 +010038The main focus of the libc++ team has been to implement new C++20 and C++23
39features.
40
41The C++20 format library has improved but it not yet considered stable. The
42main improvements are additional formatters for the chrono calendar types. Work
43on formatting ranges has started.
44
45The C++20 ranges library has been completed and is no longer experimental. Some
46``views`` have not been implemented yet. Work on C++23 ranges has started.
47
48The C++20 spaceship operator has been added to more types, the work is still
49ongoing.
50
Nikolas Klauser4f4a9bd2022-06-17 20:20:48 +020051Implemented Papers
52------------------
Igor Zhukova925f622022-08-02 12:46:31 +020053- P2499R0 - ``string_view`` range constructor should be ``explicit``
Nikolas Klauser73015c12022-08-13 13:52:35 +020054- P2417R2 - A more constexpr bitset
Igor Zhukov57ea60e2022-08-21 22:21:08 +070055- P2445R1 - ``std::forward_like``
Igor Zhukov85a33632022-09-03 18:49:50 +070056- P2273R3 - Making ``std::unique_ptr`` constexpr
Nikolas Klauser96fa4132022-10-04 17:55:42 +020057- P0591R4 - Utility functions to implement uses-allocator construction
Mark de Wever790768c2022-08-06 10:47:53 +020058- P2291R3 - Add Constexpr Modifiers to Functions ``to_chars`` and
59 ``from_chars`` for Integral Types in ``<charconv>`` Header
Nikolas Klauserf8ff2972022-10-18 21:33:32 +020060- P0220R1 - Adopt Library Fundamentals V1 TS Components for C++17
61- P0482R6 - char8_t: A type for UTF-8 characters and strings
Nikolas Klauser1b531cf2022-08-09 13:17:30 +020062- P2438R2 - ``std::string::substr() &&``
Nikolas Klausere75f7992022-11-29 19:42:16 +010063- P0600R1 - ``nodiscard`` in the library
Nikolas Klausere4e39ce2022-12-01 23:17:53 +010064- P0339R6 - ``polymorphic_allocator<>`` as a vocabulary type
Nikolas Klauser29485402022-10-01 21:25:13 +020065- P1169R4 - ``static operator()``
Marek Kurdej4d6c6e52022-12-15 02:19:59 +010066- P0415R1 - ``constexpr`` for ``std::complex``
James Y Knightb35329a2023-01-11 15:53:03 -050067- P1208R6 - ``std::source_location``
Mark de Wever833949d2023-01-09 19:06:25 +010068- P0323R12 - ``std::expected``
Hui Xie885d5d12022-11-04 11:53:38 +000069- P1035R7 - Input Range Adaptors
Konstantin Varlamovfad0eab2023-01-17 22:45:46 -080070- P2325R3 - Views should not be required to be default constructible
Nikolas Klauser0e3d3a02022-12-11 11:32:54 +010071- P2446R2 - ``views::as_rvalue``
Hui29e48882023-01-18 23:26:34 +000072- P1020R1 - Smart pointer creation with default initialization
73- P2210R2 - Superior String Splitting
Louis Dionne42222072018-09-06 14:46:22 +000074
Louis Dionne1ce86ad2022-07-21 12:48:14 -040075Improvements and New Features
76-----------------------------
Tom Honermann8a07d8c2022-09-10 10:16:20 -040077- Declarations of ``std::c8rtomb()`` and ``std::mbrtoc8()`` from P0482R6 are
78 now provided when implementations in the global namespace are provided by
79 the C library.
Arthur O'Dwyerebf2d342022-10-06 16:53:30 -040080- Implemented ``<memory_resource>`` header from C++17
Mark de Wever833949d2023-01-09 19:06:25 +010081- `D122780 <https://reviews.llvm.org/D122780>`_ Improved the performance of std::sort
Nikolas Klauserbb446e82022-11-20 23:16:20 +010082- The ``ranges`` versions of ``copy``, ``move``, ``copy_backward`` and ``move_backward`` are now also optimized for
83 ``std::deque<>::iterator``, which can lead to up to 20x performance improvements on certain algorithms.
Nikolas Klausercf03da92022-11-21 12:41:15 +010084- The ``std`` and ``ranges`` versions of ``copy``, ``move``, ``copy_backward`` and ``move_backward`` are now also
85 optimized for ``join_view::iterator``, which can lead to up to 20x performance improvements on certain combinations of
86 iterators and algorithms.
Nikolas Klauser4f4a9bd2022-06-17 20:20:48 +020087
Louis Dionne1ce86ad2022-07-21 12:48:14 -040088Deprecations and Removals
89-------------------------
Louis Dionneeafd6fb2022-09-26 09:45:14 -040090- ``unary_function`` and ``binary_function`` are no longer provided in C++17 and newer Standard modes.
91 They can be re-enabled with ``_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION``.
92
Mark de Weverf6df9e82022-08-20 10:34:26 +020093- Several incidental transitive includes have been removed from libc++. Those
94 includes are removed based on the language version used. Incidental transitive
95 inclusions of the following headers have been removed:
96
Mark de Wever833949d2023-01-09 19:06:25 +010097 - C++11, C++14, C++17, and C++20: ``chrono``
Mark de Weverf6df9e82022-08-20 10:34:26 +020098 - C++2b: ``algorithm``, ``array``, ``atomic``, ``bit``, ``chrono``,
Mark de Wever19ffb9c2022-12-10 15:28:15 +010099 ``climits``, ``cmath``, ``compare``, ``concepts``, ``cstdarg``, ``cstddef``,
Mark de Weveradc1d1c2022-09-03 13:37:09 +0200100 ``cstdint``, ``cstdlib``, ``cstring``, ``ctime``, ``exception``,
101 ``functional``, ``initializer_list``, ``iosfwd``, ``iterator``, ``limits``,
102 ``memory``, ``new``, ``numeric``, ``optional``, ``ratio``, ``stdexcept``,
103 ``string``, ``tuple``, ``type_traits``, ``typeinfo``, ``unordered_map``,
104 ``utility``, ``variant``, ``vector``.
Mark de Weverf6df9e82022-08-20 10:34:26 +0200105
106 Users can also remove all incidental transitive includes by defining
107 ``_LIBCPP_REMOVE_TRANSITIVE_INCLUDES`` regardless of the language version
108 in use. Note that in the future, libc++ reserves the right to remove
109 incidental transitive includes more aggressively, in particular regardless
110 of the language version in use.
111
Mark de Wever833949d2023-01-09 19:06:25 +0100112- The legacy testing system for libc++, libc++abi, and libunwind has been removed.
Louis Dionne591c9912022-05-26 10:58:28 -0400113 All known clients have been migrated to the new configuration system, but please
114 reach out to the libc++ developers if you find something missing in the new
115 configuration system.
Louis Dionne12507ef2022-03-07 09:00:17 -0500116
Mark de Wever625a5eb2022-09-02 18:46:59 +0200117- The functions ``to_chars`` and ``from_chars`` for integral types are
118 available starting with C++17. Libc++ offered these functions in C++11 and
119 C++14 as an undocumented extension. This extension makes it hard to implement
120 the C++23 paper that makes these functions ``constexpr``, therefore the
121 extension has been removed.
122
Nikolas Klausercc9c0de2022-10-19 11:07:34 +0200123- The ``_LIBCPP_ENABLE_CXX03_FUNCTION`` macro that allowed re-enabling the now-deprecated C++03 implementation of
124 ``std::function`` has been removed. Users who need to use ``std::function`` should switch to C++11 and above.
125
Nikolas Klauserf8571ea2022-10-19 11:06:12 +0200126- The contents of ``<experimental/memory_resource>`` are now deprecated since libc++ ships ``<memory_resource>`` now.
127 Please migrate to ``<memory_resource>`` instead. Per libc++'s TS deprecation policy,
128 ``<experimental/memory_resource>`` will be removed in LLVM 18.
129
Louis Dionne81925932022-11-14 09:56:35 -1000130- The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to
131 ``_LIBCPP_ENABLE_DEBUG_MODE`` instead.
132
Louis Dionne1ce86ad2022-07-21 12:48:14 -0400133Upcoming Deprecations and Removals
134----------------------------------
Louis Dionnee2872e32022-11-23 14:06:14 -0500135- The base template for ``std::char_traits`` has been marked as deprecated and will be removed in LLVM 18. If
136 you are using ``std::char_traits`` with types other than ``char``, ``wchar_t``, ``char8_t``, ``char16_t``,
137 ``char32_t`` or a custom character type for which you specialized ``std::char_traits``, your code will stop
138 working when we remove the base template. The Standard does not mandate that a base template is provided,
139 and such a base template is bound to be incorrect for some types, which could currently cause unexpected
140 behavior while going undetected.
Louis Dionne1ce86ad2022-07-21 12:48:14 -0400141
Adrian Vogelsgesang55e0c492022-07-31 16:12:42 -0700142API Changes
143-----------
144- The comparison operators on ``thread::id`` are now defined as free-standing
145 functions instead of as hidden friends, in conformance with the C++ standard.
146 Also see `issue 56187 <https://github.com/llvm/llvm-project/issues/56187>`_.
147
Nikolas Klauser3e7bca12022-08-19 15:41:56 +0200148- ``_LIBCPP_ENABLE_NODISCARD`` and ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`` are no longer respected.
149 Any standards-required ``[[nodiscard]]`` applications in C++20 are now always enabled. Any extended applications
Nikolas Klauserbbb13612022-09-01 12:02:58 +0200150 are now enabled by default and can be disabled by defining ``_LIBCPP_DISABLE_NODISCARD_EXT``.
Nikolas Klauser3e7bca12022-08-19 15:41:56 +0200151
Louis Dionnec23f69f2022-09-19 15:38:18 -0400152- ``_LIBCPP_VERSION`` was previously defined to e.g. ``15001`` to represent LLVM 15.0.01, but this value had been
153 left undocumented. Starting with LLVM 16, ``_LIBCPP_VERSION`` will contain the version of LLVM represented as
154 ``XXYYZZ``. In other words, ``_LIBCPP_VERSION`` is gaining a digit. This should not be an issue for existing
155 code, since using e.g. ``_LIBCPP_VERSION > 15000`` will still give the right answer now that ``_LIBCPP_VERSION``
156 is defined as e.g. ``160000`` (with one more digit).
157
Louis Dionne1ce86ad2022-07-21 12:48:14 -0400158ABI Affecting Changes
159---------------------
Louis Dionneade70ff2022-09-06 17:07:18 -0400160- In freestanding mode, ``atomic<small enum class>`` does not contain a lock byte anymore if the platform
161 can implement lockfree atomics for that size. More specifically, in LLVM <= 11.0.1, an ``atomic<small enum class>``
162 would not contain a lock byte. This was broken in LLVM >= 12.0.0, where it started including a lock byte despite
163 the platform supporting lockfree atomics for that size. Starting in LLVM 15.0.1, the ABI for these types has been
164 restored to what it used to be (no lock byte), which is the most efficient implementation.
165
166 This ABI break only affects users that compile with ``-ffreestanding``, and only for ``atomic<T>`` where ``T``
167 is a non-builtin type that could be lockfree on the platform. See https://llvm.org/D133377 for more details.
Joe Loser8fcb1d92021-10-28 15:38:02 -0400168
Alex Richardsonf7e00ca2022-06-20 15:44:57 +0100169- When building libc++ against newlib/picolibc, the type of ``regex_type_traits::char_class_type`` was changed to
170 ``uint16_t`` since all values of ``ctype_base::mask`` are taken. This is technically an ABI break, but including
171 ``<regex> `` has triggered a ``static_assert`` failure since libc++ 14, so it is unlikely that this causes
Louis Dionne44ad48b2022-11-23 10:31:21 -0500172 problems for existing users.
Alex Richardsonf7e00ca2022-06-20 15:44:57 +0100173
Louis Dionne14918c82021-10-18 13:58:31 -0400174Build System Changes
175--------------------
Louis Dionne6a0104e2022-09-21 09:50:53 -0400176- Support for ``libcxx``, ``libcxxabi`` and ``libunwind`` in ``LLVM_ENABLE_PROJECTS`` has officially
177 been removed. Instead, please build according to :ref:`these instructions <build instructions>`.