Skip to content

Commit 7140050

Browse files
committed
[libc++] Updates C++2b to C++23.
During the ISO C++ Committee meeting plenary session the C++23 Standard has been voted as technical complete. This updates the reference to c++2b to c++23 and updates the __cplusplus macro. Note since we use clang-tidy 16 a small work-around is needed. Clang knows -std=c++23 but clang-tidy not so for now force the lit compiler flag to use -std=c++2b instead of -std=c++23. Reviewed By: #libc, philnik, jloser, ldionne Differential Revision: https://reviews.llvm.org/D150795
1 parent 90418dc commit 7140050

File tree

95 files changed

+1335
-1327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1335
-1327
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
set(LIBCXX_TEST_PARAMS "std=c++2b" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++23" CACHE STRING "")
22
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ Status
298298
------------------------------------------------- -----------------
299299
``__cpp_lib_unwrap_ref`` ``201811L``
300300
------------------------------------------------- -----------------
301-
**C++ 2b**
301+
**C++ 23**
302302
-------------------------------------------------------------------
303303
``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
304304
------------------------------------------------- -----------------

libcxx/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Deprecations and Removals
7070
includes are removed based on the language version used. Incidental transitive
7171
inclusions of the following headers have been removed:
7272

73-
- C++2b: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``limits``, ``new``,
73+
- C++23: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``limits``, ``new``,
7474
``stdexcept``, ``system_error``, ``type_traits``, ``typeinfo``
7575

7676
- ``<algorithm>`` no longer includes ``<chrono>`` in any C++ version (it was previously included in C++17 and earlier).

libcxx/docs/Status/Cxx2b.rst renamed to libcxx/docs/Status/Cxx23.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.. _cxx2b-status:
1+
.. _cxx23-status:
22

33
================================
4-
libc++ C++2b Status
4+
libc++ C++23 Status
55
================================
66

77
.. include:: ../Helpers/Styles.rst
@@ -14,6 +14,7 @@ Overview
1414
================================
1515

1616
In November 2020, the C++ standard committee adopted the first changes to the next version of the C++ standard, known here as "C++2b" (probably to be C++23).
17+
In February 2023, the C++ standard committee approved this draft, and sent it to ISO for approval as C++23.
1718

1819
This page shows the status of libc++; the status of clang's support of the language features is `here <https://clang.llvm.org/cxx_status.html#cxx23>`__.
1920

@@ -27,13 +28,13 @@ The groups that have contributed papers:
2728

2829
.. note:: "Nothing to do" means that no library changes were needed to implement this change.
2930

30-
.. _paper-status-cxx2b:
31+
.. _paper-status-cxx23:
3132

3233
Paper Status
3334
====================================
3435

3536
.. csv-table::
36-
:file: Cxx2bPapers.csv
37+
:file: Cxx23Papers.csv
3738
:header-rows: 1
3839
:widths: auto
3940

@@ -48,13 +49,13 @@ Paper Status
4849
The formatter for ``stacktrace`` is not implemented, since ``stacktrace`` is
4950
not implemented yet.
5051
51-
.. _issues-status-cxx2b:
52+
.. _issues-status-cxx23:
5253

5354
Library Working Group Issues Status
5455
====================================
5556

5657
.. csv-table::
57-
:file: Cxx2bIssues.csv
58+
:file: Cxx23Issues.csv
5859
:header-rows: 1
5960
:widths: auto
6061

libcxx/docs/Status/Zip.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ libc++ Zip Status (P2321R2)
1212
Overview
1313
========
1414

15-
This document contains the status of the C++2b zip implementation in libc++.
15+
This document contains the status of the C++23 zip implementation in libc++.
1616
It is used to track both the status of the sub-projects of the effort and who
1717
is assigned to these sub-projects. This avoids duplicating effort.
1818

libcxx/docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Getting Started with libc++
4242
Status/Cxx14
4343
Status/Cxx17
4444
Status/Cxx20
45-
Status/Cxx2b
45+
Status/Cxx23
4646
Status/Format
4747
Status/Parallelism
4848
Status/Ranges
@@ -145,7 +145,7 @@ C++ Dialect Support
145145
* :ref:`C++14 - Complete <cxx14-status>`
146146
* :ref:`C++17 - In Progress <cxx17-status>`
147147
* :ref:`C++20 - In Progress <cxx20-status>`
148-
* :ref:`C++2b - In Progress <cxx2b-status>`
148+
* :ref:`C++23 - In Progress <cxx23-status>`
149149
* :ref:`C++ Feature Test Macro Status <feature-status>`
150150

151151

libcxx/include/__config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@
6161
# define _LIBCPP_STD_VER 17
6262
# elif __cplusplus <= 202002L
6363
# define _LIBCPP_STD_VER 20
64+
# elif __cplusplus <= 202302L
65+
# define _LIBCPP_STD_VER 23
6466
# else
6567
// Expected release year of the next C++ standard
66-
# define _LIBCPP_STD_VER 23
68+
# define _LIBCPP_STD_VER 26
6769
# endif
6870
# endif // _LIBCPP_STD_VER
6971
// NOLINTEND(libcpp-cpp-version-check)

libcxx/include/ranges

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ namespace std::ranges {
294294
// [range.zip], zip view
295295
template<input_range... Views>
296296
requires (view<Views> && ...) && (sizeof...(Views) > 0)
297-
class zip_view; // C++2b
297+
class zip_view; // C++23
298298
299299
template<class... Views>
300-
inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++2b
300+
inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++23
301301
(enable_borrowed_range<Views> && ...);
302302
303-
namespace views { inline constexpr unspecified zip = unspecified; } // C++2b
303+
namespace views { inline constexpr unspecified zip = unspecified; } // C++23
304304
305305
// [range.as.rvalue]
306306
template <view V>

libcxx/include/string

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public:
119119
explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17, constexpr since C++20
120120
basic_string(const value_type* s, const allocator_type& a = allocator_type()); // constexpr since C++20
121121
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); // constexpr since C++20
122-
basic_string(nullptr_t) = delete; // C++2b
122+
basic_string(nullptr_t) = delete; // C++23
123123
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); // constexpr since C++20
124124
template<class InputIterator>
125125
basic_string(InputIterator begin, InputIterator end,
@@ -140,7 +140,7 @@ public:
140140
allocator_type::propagate_on_container_move_assignment::value ||
141141
allocator_type::is_always_equal::value ); // C++17, constexpr since C++20
142142
basic_string& operator=(const value_type* s); // constexpr since C++20
143-
basic_string& operator=(nullptr_t) = delete; // C++2b
143+
basic_string& operator=(nullptr_t) = delete; // C++23
144144
basic_string& operator=(value_type c); // constexpr since C++20
145145
basic_string& operator=(initializer_list<value_type>); // constexpr since C++20
146146
@@ -342,9 +342,9 @@ public:
342342
constexpr bool ends_with(charT c) const noexcept; // C++20
343343
constexpr bool ends_with(const charT* s) const; // C++20
344344
345-
constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++2b
346-
constexpr bool contains(charT c) const noexcept; // C++2b
347-
constexpr bool contains(const charT* s) const; // C++2b
345+
constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++23
346+
constexpr bool contains(charT c) const noexcept; // C++23
347+
constexpr bool contains(const charT* s) const; // C++23
348348
};
349349
350350
template<class InputIterator,

libcxx/include/string_view

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace std {
9090
basic_string_view& operator=(const basic_string_view&) noexcept = default;
9191
template<class Allocator>
9292
constexpr basic_string_view(const charT* str);
93-
basic_string_view(nullptr_t) = delete; // C++2b
93+
basic_string_view(nullptr_t) = delete; // C++23
9494
constexpr basic_string_view(const charT* str, size_type len);
9595
template <class It, class End>
9696
constexpr basic_string_view(It begin, End end); // C++20
@@ -168,9 +168,9 @@ namespace std {
168168
constexpr bool ends_with(charT c) const noexcept; // C++20
169169
constexpr bool ends_with(const charT* s) const; // C++20
170170
171-
constexpr bool contains(basic_string_view s) const noexcept; // C++2b
172-
constexpr bool contains(charT c) const noexcept; // C++2b
173-
constexpr bool contains(const charT* s) const; // C++2b
171+
constexpr bool contains(basic_string_view s) const noexcept; // C++23
172+
constexpr bool contains(charT c) const noexcept; // C++23
173+
constexpr bool contains(const charT* s) const; // C++23
174174
175175
private:
176176
const_pointer data_; // exposition only

libcxx/include/type_traits

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace std
5151
template <class T> struct is_arithmetic;
5252
template <class T> struct is_fundamental;
5353
template <class T> struct is_member_pointer;
54-
template <class T> struct is_scoped_enum; // C++2b
54+
template <class T> struct is_scoped_enum; // C++23
5555
template <class T> struct is_scalar;
5656
template <class T> struct is_object;
5757
template <class T> struct is_compound;
@@ -286,7 +286,7 @@ namespace std
286286
template <class T> inline constexpr bool is_member_pointer_v
287287
= is_member_pointer<T>::value; // C++17
288288
template <class T> inline constexpr bool is_scoped_enum_v
289-
= is_scoped_enum<T>::value; // C++2b
289+
= is_scoped_enum<T>::value; // C++23
290290
291291
// See C++14 20.10.4.3, type properties
292292
template <class T> inline constexpr bool is_const_v

libcxx/include/utility

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ template <size_t I>
240240
241241
// [utility.underlying], to_underlying
242242
template <class T>
243-
constexpr underlying_type_t<T> to_underlying( T value ) noexcept; // C++2b
243+
constexpr underlying_type_t<T> to_underlying( T value ) noexcept; // C++23
244244
245245
} // std
246246

libcxx/test/libcxx/numerics/c.math/constexpr-cxx2b-clang.pass.cpp renamed to libcxx/test/libcxx/numerics/c.math/constexpr-cxx23-clang.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// Check that Clang supports constexpr <cmath> and <cstdlib> functions
10-
// mentioned in the P0533R9 paper that is part of C++2b
10+
// mentioned in the P0533R9 paper that is part of C++23
1111
// (https://wg21.link/p0533r9)
1212
//
1313
// Every function called in this test should become constexpr. Whenever some

libcxx/test/libcxx/numerics/c.math/constexpr-cxx2b-gcc.pass.cpp renamed to libcxx/test/libcxx/numerics/c.math/constexpr-cxx23-gcc.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// Check that GCC supports constexpr <cmath> and <cstdlib> functions
10-
// mentioned in the P0533R9 paper that is part of C++2b
10+
// mentioned in the P0533R9 paper that is part of C++23
1111
// (https://wg21.link/p0533r9)
1212
//
1313
// Every function called in this test should become constexpr. Whenever some

libcxx/test/libcxx/transitive_includes.sh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import re
4040
# To re-generate the list of expected headers, temporarily set this to True, re-generate
4141
# the file and run this test.
4242
# Note that this needs to be done for all supported language versions of libc++:
43-
# for std in c++03 c++11 c++14 c++17 c++20 c++2b; do <build>/bin/llvm-lit --param std=$std ${path_to_this_file}; done
43+
# for std in c++03 c++11 c++14 c++17 c++20 c++23; do <build>/bin/llvm-lit --param std=$std ${path_to_this_file}; done
4444
regenerate_expected_results = False
4545
# Used because the sequence of tokens RUN : can't appear anywhere or it'll confuse Lit.
4646
RUN = "RUN"

libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
// This test fails in Windows DLL configurations, due to
1414
// __exclude_from_explicit_instantiation__ not behaving as it should in
1515
// combination with dllimport (https://llvm.org/PR41018), in combination
16-
// with running tests in c++2b mode while building the library in c++20 mode.
16+
// with running tests in c++23 mode while building the library in c++20 mode.
1717
//
18-
// If the library was built in c++2b mode, this test would succeed.
18+
// If the library was built in c++23 mode, this test would succeed.
1919
//
2020
// Older CMake passed -std:c++latest to set C++ 20 mode on clang-cl, which
2121
// hid this issue. With newer CMake versions, it passes -std:c++20 which
2222
// makes this fail.
2323
//
2424
// Marking as UNSUPPORTED instead of XFAIL to avoid spurious failures/successes
2525
// depending on the version of CMake used.
26-
// TODO: Remove this when the library is built in c++2b mode.
26+
// TODO: Remove this when the library is built in c++23 mode.
2727
//
2828
// UNSUPPORTED: windows-dll
2929

libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
__cpp_lib_constexpr_algorithms 201806L [C++20]
2121
__cpp_lib_parallel_algorithm 201603L [C++17]
2222
__cpp_lib_ranges 202106L [C++20]
23-
__cpp_lib_ranges_starts_ends_with 202106L [C++2b]
23+
__cpp_lib_ranges_starts_ends_with 202106L [C++23]
2424
__cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
2525
__cpp_lib_sample 201603L [C++17]
2626
__cpp_lib_shift 201806L [C++20]
@@ -48,7 +48,7 @@
4848
# endif
4949

5050
# ifdef __cpp_lib_ranges_starts_ends_with
51-
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
51+
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
5252
# endif
5353

5454
# ifdef __cpp_lib_robust_nonmodifying_seq_ops
@@ -82,7 +82,7 @@
8282
# endif
8383

8484
# ifdef __cpp_lib_ranges_starts_ends_with
85-
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
85+
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
8686
# endif
8787

8888
# ifndef __cpp_lib_robust_nonmodifying_seq_ops
@@ -131,7 +131,7 @@
131131
# endif
132132

133133
# ifdef __cpp_lib_ranges_starts_ends_with
134-
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
134+
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
135135
# endif
136136

137137
# ifndef __cpp_lib_robust_nonmodifying_seq_ops
@@ -189,7 +189,7 @@
189189
# endif
190190

191191
# ifdef __cpp_lib_ranges_starts_ends_with
192-
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
192+
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
193193
# endif
194194

195195
# ifndef __cpp_lib_robust_nonmodifying_seq_ops
@@ -216,25 +216,25 @@
216216
#elif TEST_STD_VER > 20
217217

218218
# ifndef __cpp_lib_clamp
219-
# error "__cpp_lib_clamp should be defined in c++2b"
219+
# error "__cpp_lib_clamp should be defined in c++23"
220220
# endif
221221
# if __cpp_lib_clamp != 201603L
222-
# error "__cpp_lib_clamp should have the value 201603L in c++2b"
222+
# error "__cpp_lib_clamp should have the value 201603L in c++23"
223223
# endif
224224

225225
# ifndef __cpp_lib_constexpr_algorithms
226-
# error "__cpp_lib_constexpr_algorithms should be defined in c++2b"
226+
# error "__cpp_lib_constexpr_algorithms should be defined in c++23"
227227
# endif
228228
# if __cpp_lib_constexpr_algorithms != 201806L
229-
# error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++2b"
229+
# error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++23"
230230
# endif
231231

232232
# if !defined(_LIBCPP_VERSION)
233233
# ifndef __cpp_lib_parallel_algorithm
234-
# error "__cpp_lib_parallel_algorithm should be defined in c++2b"
234+
# error "__cpp_lib_parallel_algorithm should be defined in c++23"
235235
# endif
236236
# if __cpp_lib_parallel_algorithm != 201603L
237-
# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2b"
237+
# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
238238
# endif
239239
# else // _LIBCPP_VERSION
240240
# ifdef __cpp_lib_parallel_algorithm
@@ -243,18 +243,18 @@
243243
# endif
244244

245245
# ifndef __cpp_lib_ranges
246-
# error "__cpp_lib_ranges should be defined in c++2b"
246+
# error "__cpp_lib_ranges should be defined in c++23"
247247
# endif
248248
# if __cpp_lib_ranges != 202106L
249-
# error "__cpp_lib_ranges should have the value 202106L in c++2b"
249+
# error "__cpp_lib_ranges should have the value 202106L in c++23"
250250
# endif
251251

252252
# if !defined(_LIBCPP_VERSION)
253253
# ifndef __cpp_lib_ranges_starts_ends_with
254-
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++2b"
254+
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
255255
# endif
256256
# if __cpp_lib_ranges_starts_ends_with != 202106L
257-
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++2b"
257+
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
258258
# endif
259259
# else // _LIBCPP_VERSION
260260
# ifdef __cpp_lib_ranges_starts_ends_with
@@ -263,24 +263,24 @@
263263
# endif
264264

265265
# ifndef __cpp_lib_robust_nonmodifying_seq_ops
266-
# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2b"
266+
# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++23"
267267
# endif
268268
# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
269-
# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2b"
269+
# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++23"
270270
# endif
271271

272272
# ifndef __cpp_lib_sample
273-
# error "__cpp_lib_sample should be defined in c++2b"
273+
# error "__cpp_lib_sample should be defined in c++23"
274274
# endif
275275
# if __cpp_lib_sample != 201603L
276-
# error "__cpp_lib_sample should have the value 201603L in c++2b"
276+
# error "__cpp_lib_sample should have the value 201603L in c++23"
277277
# endif
278278

279279
# ifndef __cpp_lib_shift
280-
# error "__cpp_lib_shift should be defined in c++2b"
280+
# error "__cpp_lib_shift should be defined in c++23"
281281
# endif
282282
# if __cpp_lib_shift != 201806L
283-
# error "__cpp_lib_shift should have the value 201806L in c++2b"
283+
# error "__cpp_lib_shift should have the value 201806L in c++23"
284284
# endif
285285

286286
#endif // TEST_STD_VER > 20

0 commit comments

Comments
 (0)