• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1===========================================
2Libc++ 20.0.0 (In-Progress) Release Notes
3===========================================
4
5.. contents::
6   :local:
7   :depth: 2
8
9Written by the `Libc++ Team <https://libcxx.llvm.org>`_
10
11.. warning::
12
13   These are in-progress notes for the upcoming libc++ 20.0.0 release.
14   Release notes for previous releases can be found on
15   `the Download Page <https://releases.llvm.org/download.html>`_.
16
17Introduction
18============
19
20This document contains the release notes for the libc++ C++ Standard Library,
21part of the LLVM Compiler Infrastructure, release 20.0.0. Here we describe the
22status 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
24documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may
25be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
26
27For more information about libc++, please see the `Libc++ Web Site
28<https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_.
29
30Note that if you are reading this file from a Git checkout or the
31main Libc++ web page, this document applies to the *next* release, not
32the current one. To see the release notes for a specific release, please
33see the `releases page <https://llvm.org/releases/>`_.
34
35What's New in Libc++ 20.0.0?
36==============================
37
38Implemented Papers
39------------------
40
41- P0619R4: Reviewing Deprecated Facilities of C++17 for C++20 (`Github <https://github.com/llvm/llvm-project/issues/99985>`__)
42- P2747R2: ``constexpr`` placement new (`Github <https://github.com/llvm/llvm-project/issues/105427>`__)
43- P2609R3: Relaxing Ranges Just A Smidge (`Github <https://github.com/llvm/llvm-project/issues/105253>`__)
44- P2985R0: A type trait for detecting virtual base classes (`Github <https://github.com/llvm/llvm-project/issues/105432>`__)
45- ``std::jthread`` and ``<stop_token>`` are not guarded behind ``-fexperimental-library`` anymore
46- P2674R1: A trait for implicit lifetime types (`Github <https://github.com/llvm/llvm-project/issues/105259>`__)
47- P0429R9: A Standard ``flat_map`` is partially implemented and ``flat_map`` is provided (`Github <https://github.com/llvm/llvm-project/issues/105190>`__)
48
49Improvements and New Features
50-----------------------------
51
52- The ``lexicographical_compare`` and ``ranges::lexicographical_compare`` algorithms have been optimized for trivially
53  equality comparable types, resulting in a performance improvement of up to 40x.
54
55- The ``_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER`` macro has been added to make ``std::get_temporary_buffer`` and
56  ``std::return_temporary_buffer`` available.
57
58- The ``_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION`` macro has been added to make ``std::uncaught_exception``
59  available in C++20 and later modes.
60
61- The internal structure ``__compressed_pair`` has been replaced with ``[[no_unique_address]]``, resulting in reduced
62  compile times and smaller debug information as well as better code generation if optimizations are disabled.
63  The Chromium project measured a 5% reduction in object file and debug information size.
64
65- The ``_LIBCPP_ABI_BOUNDED_UNIQUE_PTR`` ABI configuration was added, which allows ``std::unique_ptr<T[]>`` to
66  detect out-of-bounds accesses in certain circumstances. ``std::unique_ptr<T[]>`` can now also detect out-of-bounds
67  accesses for a limited set of types (non-trivially destructible types) when the ABI configuration is disabled.
68
69- The ``_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY`` ABI configuration was added, which allows storing valid bounds
70  in ``std::array::iterator`` and detecting OOB accesses when the appropriate hardening mode is enabled.
71
72- The input iterator overload of `assign(_InputIterator, _InputIterator)` in `std::vector<_Tp, _Allocator>` has been
73  optimized, resulting in a performance improvement of up to 2x for trivial element types (e.g., `std::vector<int>`),
74  and up to 3.4x for non-trivial element types (e.g., `std::vector<std::vector<int>>`).
75
76Deprecations and Removals
77-------------------------
78
79- The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable and the ``_LIBCPP_ENABLE_ASSERTIONS`` macro that were used to
80  enable the safe mode have been removed in LLVM 20. Please use :ref:`support for hardening <using-hardening-modes>`
81  instead.
82
83- Support for the C++20 synchronization library (``<barrier>``, ``<latch>``, ``atomic::wait``, etc.) has been
84  removed in language modes prior to C++20. If you are using these features prior to C++20, you will need to
85  update to ``-std=c++20``.
86
87- TODO: The relational operators for ``std::chrono::weekday`` will be removed entirely, and the
88  ``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension will be
89  ignored in LLVM 20.
90
91- The ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro no longer has any effect. ``std::allocator<const T>`` is not
92  supported as an extension anymore, please migrate any code that uses e.g. ``std::vector<const T>`` to be
93  standards conforming.
94
95- Non-conforming member typedefs ``base``, ``iterator`` and ``const_iterator`` of ``std::bitset``, and member typedef
96  ``base`` of ``std::forward_list`` and ``std::list`` are removed. Previously, they were private but could cause
97  ambiguity in name lookup. Code that expects such ambiguity will possibly not compile in LLVM 20.
98
99- The function ``__libcpp_verbose_abort()`` is now ``noexcept``, to match ``std::terminate()``. (The combination of
100  ``noexcept`` and ``[[noreturn]]`` has special significance for function effects analysis.) For backwards compatibility,
101  the ``_LIBCPP_VERBOSE_ABORT_NOT_NOEXCEPT`` macro can be defined to make the function non-``noexcept``. That macro
102  will be removed in LLVM 21.
103
104- ``<ccomplex>``, ``<cstdalign>`` (previously missing), ``<cstdbool>``, and ``<ctgmath>`` are deprecated since C++17 as
105  specified by the standard. They, together with ``<ciso646>``, are removed in C++20, but libc++ still provides these
106  headers as an extension and only deprecates them. The ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS`` macro can be defined to
107  suppress deprecation for these headers.
108
109- The ``_LIBCPP_DISABLE_AVAILABILITY`` macro that was used to force-disable availability markup has now been removed.
110  Whether availability markup is used by the library is now solely controlled at configuration-time.
111
112- The pointer safety functions ``declare_reachable``, ``declare_no_pointers``, ``undeclare_no_pointers`` and
113  ``__undeclare_reachable`` have been removed from the library. These functions were never implemented in a non-trivial
114  way, making it very unlikely that any binary depends on them.
115
116Upcoming Deprecations and Removals
117----------------------------------
118
119LLVM 21
120~~~~~~~
121
122- The status of the C++03 implementation will be frozen after the LLVM 21 release. This means that starting in LLVM 22,
123  non-critical bug fixes may not be back-ported to C++03, including LWG issues. C++03 is a legacy platform, where most
124  projects are no longer actively maintained. To reduce the amount of fixes required to keep such legacy projects
125  compiling with up-to-date toolchains, libc++ will aim to freeze the status of the headers in C++03 mode to avoid
126  unintended breaking changes. See https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc for more details.
127
128  If you are using C++03 in your project, you should consider moving to a newer version of the Standard to get the most
129  out of libc++.
130
131- The ``_LIBCPP_VERBOSE_ABORT_NOT_NOEXCEPT`` macro will be removed in LLVM 21, making ``std::__libcpp_verbose_abort``
132  unconditionally ``noexcept``.
133
134
135ABI Affecting Changes
136---------------------
137
138- The ABI breaks for removing undefined behaviour in ``std::forward_list``, ``std::list``, ``std::map``, ``std::set``,
139  ``std::multimap``, ``std::multiset``, ``std::unordered_map``, ``std::unordered_set``, ``std::unordered_multimap`` and
140  ``std::unordered_multiset`` are now applied unconditionally. This only affects fancy pointers which have a different
141  value representation when pointing at the base of an internal node type instead of the type itself. A size or
142  alignment difference is diagnosed, but more subtle ABI breaks may result in unexpected behaviour.
143
144- The internal structure ``__compressed_pair`` has been replaced with ``[[no_unique_address]]``. The ABI impact is:
145
146  - When using the Itanium ABI (most non-MSVC platforms), empty types are now placed at the beginning of the enclosing
147    object instead of where the beginning of the ``__compressed_pair`` subobject was. This is only observable by
148    checking the address of the empty allocator, equality comparator or hasher.
149  - Additionally, using an overaligned empty type as an allocator, comparator or hasher in the associative containers
150    (and only those containers) may result in the container's object object size and data layout changing beyond only
151    the address of the empty member.
152  - When using the MSVC ABI, this change results in some classes having a completely different memory layout, so this is
153    a genuine ABI break. However, the library does not currently guarantee ABI stability on MSVC platforms.
154
155Build System Changes
156--------------------
157
158- TODO
159